Checkpoint of app-specific single-instance checking.
(I'm about to nuke single-instance checking entirely, but wanted to make sure this was captured in GIT somewhere.)
This commit is contained in:
parent
8631d670a4
commit
3d7e18561d
|
@ -206,7 +206,7 @@ const wxString PGM_BASE::AskUserForPreferredEditor( const wxString& aDefaultEdit
|
||||||
|
|
||||||
bool PGM_BASE::InitPgm( bool aHeadless )
|
bool PGM_BASE::InitPgm( bool aHeadless )
|
||||||
{
|
{
|
||||||
wxFileName pgm_name( App().argv[0] );
|
wxString pgm_name = wxFileName( App().argv[0] ).GetName().Lower();
|
||||||
|
|
||||||
wxInitAllImageHandlers();
|
wxInitAllImageHandlers();
|
||||||
|
|
||||||
|
@ -219,17 +219,32 @@ bool PGM_BASE::InitPgm( bool aHeadless )
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_pgm_checker = new wxSingleInstanceChecker( pgm_name.GetName().Lower() + wxT( "-" ) +
|
m_pgm_checker = new wxSingleInstanceChecker( pgm_name + wxT( "-" ) +
|
||||||
wxGetUserId(), GetKicadLockFilePath() );
|
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( m_pgm_checker->IsAnotherRunning() )
|
||||||
{
|
{
|
||||||
if( !IsOK( NULL, wxString::Format( _( "%s is already running. Continue?" ),
|
if( pgm_name == "pcb_calculator"
|
||||||
|
|| pgm_name == "gerbview"
|
||||||
|
|| pgm_name == "bitmap2component" )
|
||||||
|
{
|
||||||
|
// 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() ) ) )
|
App().GetAppDisplayName() ) ) )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Init KiCad environment
|
// Init KiCad environment
|
||||||
// the environment variable KICAD (if exists) gives the kicad path:
|
// the environment variable KICAD (if exists) gives the kicad path:
|
||||||
|
@ -246,7 +261,7 @@ bool PGM_BASE::InitPgm( bool aHeadless )
|
||||||
|
|
||||||
// Init parameters for configuration
|
// Init parameters for configuration
|
||||||
App().SetVendorName( "KiCad" );
|
App().SetVendorName( "KiCad" );
|
||||||
App().SetAppName( pgm_name.GetName().Lower() );
|
App().SetAppName( pgm_name );
|
||||||
|
|
||||||
// Install some image handlers, mainly for help
|
// Install some image handlers, mainly for help
|
||||||
if( wxImage::FindHandler( wxBITMAP_TYPE_PNG ) == NULL )
|
if( wxImage::FindHandler( wxBITMAP_TYPE_PNG ) == NULL )
|
||||||
|
|
|
@ -39,7 +39,7 @@ int main( int argc, char** argv )
|
||||||
{
|
{
|
||||||
wxInitialize( argc, argv );
|
wxInitialize( argc, argv );
|
||||||
|
|
||||||
Pgm().InitPgm();
|
Pgm().InitPgm( true );
|
||||||
|
|
||||||
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
|
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
|
||||||
propMgr.Rebuild();
|
propMgr.Rebuild();
|
||||||
|
|
|
@ -254,7 +254,7 @@ int main( int argc, char** argv )
|
||||||
{
|
{
|
||||||
wxInitialize( argc, argv );
|
wxInitialize( argc, argv );
|
||||||
|
|
||||||
Pgm().InitPgm();
|
Pgm().InitPgm( true );
|
||||||
|
|
||||||
auto ret = wxEntry( argc, argv );
|
auto ret = wxEntry( argc, argv );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue