diff --git a/common/edaappl.cpp b/common/edaappl.cpp index 25f3f1d2ca..6058e47ebd 100644 --- a/common/edaappl.cpp +++ b/common/edaappl.cpp @@ -452,17 +452,16 @@ bool EDA_APP::SetBinDir() m_BinDir = FROM_UTF8( native_str ); delete[] native_str; - // Linux and Unix -#elif defined(__UNIX__) - m_BinDir = wxStandardPaths().GetExecutablePath(); +#elif defined(__UNIX__) // Linux and non-Apple Unix + m_BinDir = wxStandardPaths::Get().GetExecutablePath(); + #else m_BinDir = argv[0]; -#endif // __UNIX__ +#endif - /* Use unix notation for paths. I am not sure this is a good idea, - * but it simplify compatibility between Windows and Unices - * However it is a potential problem in path handling under Windows - */ + // Use unix notation for paths. I am not sure this is a good idea, + // but it simplify compatibility between Windows and Unices + // However it is a potential problem in path handling under Windows m_BinDir.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP ); // Remove file name form command line: @@ -1133,11 +1132,13 @@ void EDA_APP::InsertLibraryPath( const wxString& aPaths, size_t aIndex ) } } + bool EDA_APP::LockFile( const wxString& fileName ) { // first make absolute and normalize, to avoid that different lock files // for the same file can be created wxFileName fn = fileName; + fn.MakeAbsolute(); // semaphore to protect the edition of the file by more than one instance @@ -1146,11 +1147,16 @@ bool EDA_APP::LockFile( const wxString& fileName ) // it means that we had an open file and we are opening a different one delete m_oneInstancePerFileChecker; } + wxString lockFileName = fn.GetFullPath() + wxT( ".lock" ); + lockFileName.Replace( wxT( "/" ), wxT( "_" ) ); + // We can have filenames coming from Windows, so also convert Windows separator lockFileName.Replace( wxT( "\\" ), wxT( "_" ) ); + m_oneInstancePerFileChecker = new wxSingleInstanceChecker( lockFileName ); + if( m_oneInstancePerFileChecker && m_oneInstancePerFileChecker->IsAnotherRunning() ) {