Only try to copy design rules file if it exists

This commit is contained in:
Jon Evans 2021-04-15 20:43:35 -04:00
parent 23a1f8b17a
commit 928d336bee
1 changed files with 8 additions and 4 deletions

View File

@ -941,8 +941,10 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool addToHistory,
if( !projectFile.FileExists() && aChangeProject )
GetSettingsManager()->SaveProjectAs( projectFile.GetFullPath() );
if( !rulesFile.FileExists() && aChangeProject )
KiCopyFile( GetDesignRulesPath(), rulesFile.GetFullPath(), msg );
wxFileName currentRules( GetDesignRulesPath() );
if( currentRules.FileExists() && !rulesFile.FileExists() && aChangeProject )
KiCopyFile( currentRules.GetFullPath(), rulesFile.GetFullPath(), msg );
if( !msg.IsEmpty() )
{
@ -1096,8 +1098,10 @@ bool PCB_EDIT_FRAME::SavePcbCopy( const wxString& aFileName, bool aCreateProject
if( aCreateProject && !projectFile.FileExists() )
GetSettingsManager()->SaveProjectCopy( projectFile.GetFullPath() );
if( aCreateProject && !rulesFile.FileExists() )
KiCopyFile( GetDesignRulesPath(), rulesFile.GetFullPath(), msg );
wxFileName currentRules( GetDesignRulesPath() );
if( aCreateProject && currentRules.FileExists() && !rulesFile.FileExists() )
KiCopyFile( currentRules, rulesFile.GetFullPath(), msg );
if( !msg.IsEmpty() )
{