diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index 2ac7f62b59..f3c1c14a86 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -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() ) {