Use a more specific path for instance checker

This commit is contained in:
Jon Evans 2024-02-06 21:32:55 -05:00
parent e55a803572
commit 874be359e0
3 changed files with 21 additions and 2 deletions

View File

@ -385,6 +385,16 @@ wxString PATHS::GetDocumentationPath()
}
wxString PATHS::GetInstanceCheckerPath()
{
wxFileName path;
path.AssignDir( wxStandardPaths::Get().GetTempDir() );
path.AppendDir( "kicad" );
path.AppendDir( "instances" );
return path.GetPathWithSep();
}
bool PATHS::EnsurePathExists( const wxString& aPath )
{
wxFileName path( aPath );
@ -576,4 +586,4 @@ const wxString& PATHS::GetExecutablePath()
}
return exe_path;
}
}

View File

@ -489,8 +489,12 @@ bool PGM_BASE::InitPgm( bool aHeadless, bool aSkipPyInit, bool aIsUnitTest )
return false;
}
#endif
wxString instanceCheckerDir = PATHS::GetInstanceCheckerPath();
PATHS::EnsurePathExists( instanceCheckerDir );
m_pgm_checker = std::make_unique<wxSingleInstanceChecker>();
m_pgm_checker->Create( pgm_name, wxStandardPaths::Get().GetTempDir() );
m_pgm_checker->Create( pgm_name, instanceCheckerDir );
// Init KiCad environment
// the environment variable KICAD (if exists) gives the kicad path:

View File

@ -148,6 +148,11 @@ public:
*/
static wxString GetDocumentationPath();
/**
* Gets the path used for wxSingleInstanceChecker lock files
*/
static wxString GetInstanceCheckerPath();
/**
* Attempts to create a given path if it does not exist
*/