Browse Source

Use a more specific path for instance checker

newinvert
Jon Evans 2 years ago
parent
commit
874be359e0
  1. 12
      common/paths.cpp
  2. 6
      common/pgm_base.cpp
  3. 5
      include/paths.h

12
common/paths.cpp

@ -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;
}
}

6
common/pgm_base.cpp

@ -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:

5
include/paths.h

@ -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
*/

Loading…
Cancel
Save