#include <build_version.h>
#include <lockfile.h>
#include <wx/filename.h>
#include <wx/snglinst.h>
#include <common.h>
Go to the source code of this file.
|
std::unique_ptr< wxSingleInstanceChecker > | LockFile (const wxString &aFileName) |
| Test to see if aFileName can be locked (is not already locked) and only then returns a wxSingleInstanceChecker protecting aFileName. More...
|
|
wxString | GetKicadLockFilePath () |
|
◆ GetKicadLockFilePath()
wxString GetKicadLockFilePath |
( |
| ) |
|
- Returns
- A wxString containing the path for lockfiles in Kicad.
Definition at line 60 of file lockfile.cpp.
63 lockpath.AssignDir( wxGetHomeDir() );
65 #if defined( __WXMAC__ ) 67 lockpath.AppendDir(
"Library" );
68 lockpath.AppendDir(
"Caches" );
69 lockpath.AppendDir(
"kicad" );
70 #elif defined( __UNIX__ ) 73 if( wxGetEnv(
"XDG_RUNTIME_DIR", &envstr ) && !envstr.IsEmpty() )
75 lockpath.AssignDir( envstr );
77 else if( wxGetEnv(
"XDG_CACHE_HOME", &envstr ) && !envstr.IsEmpty() )
79 lockpath.AssignDir( envstr );
84 lockpath.AppendDir(
".cache" );
90 #if defined( __WXMAC__ ) || defined( __UNIX__ ) 91 if( !lockpath.DirExists() )
94 lockpath.Mkdir( 0700, wxPATH_MKDIR_FULL );
97 return lockpath.GetPath();
wxString GetMajorMinorVersion()
Get only the major and minor version in a string major.minor.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
References Format(), and GetMajorMinorVersion().
Referenced by PGM_BASE::InitPgm(), and LockFile().
◆ LockFile()
std::unique_ptr<wxSingleInstanceChecker> LockFile |
( |
const wxString & |
aFileName | ) |
|
Test to see if aFileName can be locked (is not already locked) and only then returns a wxSingleInstanceChecker protecting aFileName.
Definition at line 33 of file lockfile.cpp.
37 wxFileName fn( aFileName );
41 wxString lockFileName = fn.GetFullPath() +
".lock";
43 lockFileName.Replace(
"/",
"_" );
46 lockFileName.Replace(
"\\",
"_" );
48 auto p = std::make_unique<wxSingleInstanceChecker>( lockFileName,
51 if( p->IsAnotherRunning() )
wxString GetKicadLockFilePath()
References GetKicadLockFilePath().