Don't create project files unconditionally when importing boards
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7368
This commit is contained in:
parent
62254309b0
commit
b314e0828c
|
@ -62,15 +62,17 @@ PCB_BASE_EDIT_FRAME::~PCB_BASE_EDIT_FRAME()
|
||||||
void PCB_BASE_EDIT_FRAME::doCloseWindow()
|
void PCB_BASE_EDIT_FRAME::doCloseWindow()
|
||||||
{
|
{
|
||||||
SETTINGS_MANAGER* mgr = GetSettingsManager();
|
SETTINGS_MANAGER* mgr = GetSettingsManager();
|
||||||
|
wxFileName projectName( Prj().GetProjectFullName() );
|
||||||
|
|
||||||
if( mgr->IsProjectOpen() && wxFileName::IsDirWritable( Prj().GetProjectPath() ) )
|
if( mgr->IsProjectOpen() && wxFileName::IsDirWritable( projectName.GetPath() )
|
||||||
|
&& projectName.Exists() )
|
||||||
{
|
{
|
||||||
GFootprintList.WriteCacheToFile( Prj().GetProjectPath() + "fp-info-cache" );
|
GFootprintList.WriteCacheToFile( Prj().GetProjectPath() + "fp-info-cache" );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close the project if we are standalone, so it gets cleaned up properly
|
// Close the project if we are standalone, so it gets cleaned up properly
|
||||||
if( mgr->IsProjectOpen() && Kiface().IsSingle() )
|
if( mgr->IsProjectOpen() && Kiface().IsSingle() )
|
||||||
mgr->UnloadProject( &Prj() );
|
mgr->UnloadProject( &Prj(), false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -227,6 +227,15 @@ void PCB_EDIT_FRAME::SaveProjectSettings()
|
||||||
|
|
||||||
localSettings.m_SelectionFilter = filterOpts;
|
localSettings.m_SelectionFilter = filterOpts;
|
||||||
|
|
||||||
if( !Prj().IsNullProject() )
|
/**
|
||||||
|
* The below automatically saves the project on exit, which is what we want to do if the project
|
||||||
|
* already exists. If the project doesn't already exist, we don't want to create it through
|
||||||
|
* this function call, because this will happen automatically when the user exits even if they
|
||||||
|
* didn't save a new board with a valid filename (usually an imported board).
|
||||||
|
*
|
||||||
|
* The explicit save action in PCB_EDIT_FRAME::SavePcbFile will call SaveProject directly,
|
||||||
|
* so if the user does choose to save the board, the project file will get created then.
|
||||||
|
*/
|
||||||
|
if( !Prj().IsNullProject() && fn.Exists() )
|
||||||
GetSettingsManager()->SaveProject();
|
GetSettingsManager()->SaveProject();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue