Loading common/common.cpp +45 −5 Original line number Diff line number Diff line /* * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2014-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Loading Loading @@ -305,6 +305,46 @@ wxConfigBase* GetNewConfig( const wxString& aProgName ) return cfg; } wxString GetKicadLockFilePath() { wxFileName lockpath; lockpath.AssignDir( wxGetHomeDir() ); // Default wx behavior #if defined( __WXMAC__ ) // In OSX use the standard per user cache directory lockpath.AppendDir( wxT( "Library" ) ); lockpath.AppendDir( wxT( "Caches" ) ); lockpath.AppendDir( wxT( "kicad" ) ); #elif defined( __UNIX__ ) wxString envstr; // Try first the standard XDG_RUNTIME_DIR, falling back to XDG_CACHE_HOME if( wxGetEnv( wxT( "XDG_RUNTIME_DIR" ), &envstr ) && !envstr.IsEmpty() ) { lockpath.AssignDir( envstr ); } else if( wxGetEnv( wxT( "XDG_CACHE_HOME" ), &envstr ) && !envstr.IsEmpty() ) { lockpath.AssignDir( envstr ); } else { // If all fails, just use ~/.cache lockpath.AppendDir( wxT( ".cache" ) ); } lockpath.AppendDir( wxT( "kicad" ) ); #endif #if defined( __WXMAC__ ) || defined( __UNIX__ ) if( !lockpath.DirExists() ) { // Lockfiles should be only readable by the user lockpath.Mkdir( 0700, wxPATH_MKDIR_FULL ); } #endif return lockpath.GetPath(); } wxString GetKicadConfigPath() { Loading common/lockfile.cpp +5 −3 Original line number Diff line number Diff line /* * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors. * Copyright (C) 2014-2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2014-2015 KiCad Developers, see CHANGELOG.TXT for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Loading @@ -24,6 +24,7 @@ #include <wx/filename.h> #include <wx/snglinst.h> #include <common.h> wxSingleInstanceChecker* LockFile( const wxString& aFileName ) Loading @@ -41,7 +42,8 @@ wxSingleInstanceChecker* LockFile( const wxString& aFileName ) // We can have filenames coming from Windows, so also convert Windows separator lockFileName.Replace( wxT( "\\" ), wxT( "_" ) ); wxSingleInstanceChecker* p = new wxSingleInstanceChecker( lockFileName ); wxSingleInstanceChecker* p = new wxSingleInstanceChecker( lockFileName, GetKicadLockFilePath() ); if( p->IsAnotherRunning() ) { Loading common/pgm_base.cpp +4 −4 Original line number Diff line number Diff line /* * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2004-2015 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Loading Loading @@ -353,7 +353,7 @@ bool PGM_BASE::initPgm() wxInitAllImageHandlers(); m_pgm_checker = new wxSingleInstanceChecker( pgm_name.GetName().Lower() + wxT( "-" ) + wxGetUserId() ); m_pgm_checker = new wxSingleInstanceChecker( pgm_name.GetName().Lower() + wxT( "-" ) + wxGetUserId(), GetKicadLockFilePath() ); if( m_pgm_checker->IsAnotherRunning() ) { Loading include/common.h +11 −5 Original line number Diff line number Diff line /* * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2007-2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2014-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2007-2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Loading Loading @@ -433,6 +433,12 @@ const wxString PrePendPath( const wxString& aEnvVar, const wxString& aPriorityPa */ wxConfigBase* GetNewConfig( const wxString& aProgName ); /** * Function GetKicadLockFilePath * @return A wxString containing the path for lockfiles in Kicad */ wxString GetKicadLockFilePath(); /** * Function GetKicadConfigPath * @return A wxString containing the config path for Kicad Loading Loading
common/common.cpp +45 −5 Original line number Diff line number Diff line /* * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2014-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Loading Loading @@ -305,6 +305,46 @@ wxConfigBase* GetNewConfig( const wxString& aProgName ) return cfg; } wxString GetKicadLockFilePath() { wxFileName lockpath; lockpath.AssignDir( wxGetHomeDir() ); // Default wx behavior #if defined( __WXMAC__ ) // In OSX use the standard per user cache directory lockpath.AppendDir( wxT( "Library" ) ); lockpath.AppendDir( wxT( "Caches" ) ); lockpath.AppendDir( wxT( "kicad" ) ); #elif defined( __UNIX__ ) wxString envstr; // Try first the standard XDG_RUNTIME_DIR, falling back to XDG_CACHE_HOME if( wxGetEnv( wxT( "XDG_RUNTIME_DIR" ), &envstr ) && !envstr.IsEmpty() ) { lockpath.AssignDir( envstr ); } else if( wxGetEnv( wxT( "XDG_CACHE_HOME" ), &envstr ) && !envstr.IsEmpty() ) { lockpath.AssignDir( envstr ); } else { // If all fails, just use ~/.cache lockpath.AppendDir( wxT( ".cache" ) ); } lockpath.AppendDir( wxT( "kicad" ) ); #endif #if defined( __WXMAC__ ) || defined( __UNIX__ ) if( !lockpath.DirExists() ) { // Lockfiles should be only readable by the user lockpath.Mkdir( 0700, wxPATH_MKDIR_FULL ); } #endif return lockpath.GetPath(); } wxString GetKicadConfigPath() { Loading
common/lockfile.cpp +5 −3 Original line number Diff line number Diff line /* * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors. * Copyright (C) 2014-2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2014-2015 KiCad Developers, see CHANGELOG.TXT for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Loading @@ -24,6 +24,7 @@ #include <wx/filename.h> #include <wx/snglinst.h> #include <common.h> wxSingleInstanceChecker* LockFile( const wxString& aFileName ) Loading @@ -41,7 +42,8 @@ wxSingleInstanceChecker* LockFile( const wxString& aFileName ) // We can have filenames coming from Windows, so also convert Windows separator lockFileName.Replace( wxT( "\\" ), wxT( "_" ) ); wxSingleInstanceChecker* p = new wxSingleInstanceChecker( lockFileName ); wxSingleInstanceChecker* p = new wxSingleInstanceChecker( lockFileName, GetKicadLockFilePath() ); if( p->IsAnotherRunning() ) { Loading
common/pgm_base.cpp +4 −4 Original line number Diff line number Diff line /* * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2004-2015 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Loading Loading @@ -353,7 +353,7 @@ bool PGM_BASE::initPgm() wxInitAllImageHandlers(); m_pgm_checker = new wxSingleInstanceChecker( pgm_name.GetName().Lower() + wxT( "-" ) + wxGetUserId() ); m_pgm_checker = new wxSingleInstanceChecker( pgm_name.GetName().Lower() + wxT( "-" ) + wxGetUserId(), GetKicadLockFilePath() ); if( m_pgm_checker->IsAnotherRunning() ) { Loading
include/common.h +11 −5 Original line number Diff line number Diff line /* * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2007-2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2014-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2007-2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License Loading Loading @@ -433,6 +433,12 @@ const wxString PrePendPath( const wxString& aEnvVar, const wxString& aPriorityPa */ wxConfigBase* GetNewConfig( const wxString& aProgName ); /** * Function GetKicadLockFilePath * @return A wxString containing the path for lockfiles in Kicad */ wxString GetKicadLockFilePath(); /** * Function GetKicadConfigPath * @return A wxString containing the config path for Kicad Loading