From 928d336beedc831f9e492beece14af4867953015 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Thu, 15 Apr 2021 20:43:35 -0400 Subject: [PATCH] Only try to copy design rules file if it exists --- pcbnew/files.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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() ) {