[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 1669
Date       : Fri Aug  4 15:19:01 BST 2006

Changed paths:
   M /Trunk/XaraLX/wxOil/camelot.cpp

Attempt to fix single instance checker by using a different path for the Unix domain socket


Diff:
Index: Trunk/XaraLX/wxOil/camelot.cpp
===================================================================
--- Trunk/XaraLX/wxOil/camelot.cpp	(revision 1668)
+++ Trunk/XaraLX/wxOil/camelot.cpp	(revision 1669)
@@ -652,7 +652,9 @@
 	// is running.
 
 	// Set and check for single instance running
-	wxString IPCname = wxString(_T("XARA-XTREME-WX-"))	+GetAppName()+wxString::Format(_T("%s.ipc"), wxGetUserId().c_str());
+	wxString SIname = wxString(_T(".XARA-XTREME-WX-"))	+GetAppName()+wxString::Format(_T("-%s"), wxGetUserId().c_str());
+	wxFileName IPCfn(wxGetHomeDir(),SIname+_T(".ipc"));
+	wxString IPCname = IPCfn.GetFullPath();
 
 	m_pSingleInstanceChecker = NULL;
 	m_pServer = NULL;
@@ -666,7 +668,7 @@
 	if (SingleInstanceCheck)
 	{
 		// Create a single instance checker at that location
-		m_pSingleInstanceChecker = new wxSingleInstanceChecker(IPCname);
+		m_pSingleInstanceChecker = new wxSingleInstanceChecker(SIname);
 		if (!m_pSingleInstanceChecker)
 		{
 			ERROR2(FALSE, "Failed to create single instance checker");
@@ -742,6 +744,9 @@
 		}
 	}
 
+	// OK, we are the only instance running. Delete any stale socket (ours has not been created yet).
+	::wxRemoveFile(IPCname);
+
 	// Register the image handler which loads CURs (used for Cursors, obviously)
 	wxImage::AddHandler( new wxCURHandler );
 


Xara