diff --git a/common/pgm_base.cpp b/common/pgm_base.cpp index fd49724e5b..195be5fd34 100644 --- a/common/pgm_base.cpp +++ b/common/pgm_base.cpp @@ -206,7 +206,7 @@ const wxString PGM_BASE::AskUserForPreferredEditor( const wxString& aDefaultEdit bool PGM_BASE::InitPgm( bool aHeadless ) { - wxFileName pgm_name( App().argv[0] ); + wxString pgm_name = wxFileName( App().argv[0] ).GetName().Lower(); wxInitAllImageHandlers(); @@ -219,15 +219,30 @@ bool PGM_BASE::InitPgm( bool aHeadless ) } #endif - m_pgm_checker = new wxSingleInstanceChecker( pgm_name.GetName().Lower() + wxT( "-" ) + + m_pgm_checker = new wxSingleInstanceChecker( pgm_name + wxT( "-" ) + wxGetUserId(), GetKicadLockFilePath() ); + // It'd be nice to export this processing to the individual apps, but the current linkage + // makes that surprisingly difficult. + if( m_pgm_checker->IsAnotherRunning() ) { - if( !IsOK( NULL, wxString::Format( _( "%s is already running. Continue?" ), - App().GetAppDisplayName() ) ) ) + if( pgm_name == "pcb_calculator" + || pgm_name == "gerbview" + || pgm_name == "bitmap2component" ) { - return false; + // no warning + } + else + { + if( !IsOK( NULL, wxString::Format( _( "%s is already running. Continue?\n\n" + "Saving files from more than one %s instance may " + "cause the project file to get out of sync." ), + App().GetAppDisplayName(), + App().GetAppDisplayName() ) ) ) + { + return false; + } } } @@ -246,7 +261,7 @@ bool PGM_BASE::InitPgm( bool aHeadless ) // Init parameters for configuration App().SetVendorName( "KiCad" ); - App().SetAppName( pgm_name.GetName().Lower() ); + App().SetAppName( pgm_name ); // Install some image handlers, mainly for help if( wxImage::FindHandler( wxBITMAP_TYPE_PNG ) == NULL ) diff --git a/qa/drc_proto/drc_proto_test.cpp b/qa/drc_proto/drc_proto_test.cpp index 21054d007a..e3707d0565 100644 --- a/qa/drc_proto/drc_proto_test.cpp +++ b/qa/drc_proto/drc_proto_test.cpp @@ -39,7 +39,7 @@ int main( int argc, char** argv ) { wxInitialize( argc, argv ); - Pgm().InitPgm(); + Pgm().InitPgm( true ); PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance(); propMgr.Rebuild(); diff --git a/qa/qa_utils/test_app_main.cpp b/qa/qa_utils/test_app_main.cpp index 6a450a2398..c1054cd4a0 100644 --- a/qa/qa_utils/test_app_main.cpp +++ b/qa/qa_utils/test_app_main.cpp @@ -254,7 +254,7 @@ int main( int argc, char** argv ) { wxInitialize( argc, argv ); - Pgm().InitPgm(); + Pgm().InitPgm( true ); auto ret = wxEntry( argc, argv );