Also verify that the .dcm is writable when saving library

Fixes https://gitlab.com/kicad/code/kicad/issues/3946
This commit is contained in:
Ian McInerney 2020-02-26 19:20:47 +00:00
parent 82ae9db262
commit b2cc454878
1 changed files with 4 additions and 4 deletions

View File

@ -831,8 +831,11 @@ bool LIB_EDIT_FRAME::saveLibrary( const wxString& aLibrary, bool aNewFile )
fn = prj.SchSymbolLibTable()->GetFullURI( aLibrary ); fn = prj.SchSymbolLibTable()->GetFullURI( aLibrary );
} }
wxFileName docFileName = fn;
docFileName.SetExt( DOC_EXT );
// Verify the user has write privileges before attempting to save the library file. // Verify the user has write privileges before attempting to save the library file.
if( !IsWritable( fn ) ) if( !IsWritable( fn ) || !IsWritable( docFileName ) )
return false; return false;
ClearMsgPanel(); ClearMsgPanel();
@ -841,9 +844,6 @@ bool LIB_EDIT_FRAME::saveLibrary( const wxString& aLibrary, bool aNewFile )
if( !backupFile( fn, "bak" ) ) if( !backupFile( fn, "bak" ) )
return false; return false;
wxFileName docFileName = fn;
docFileName.SetExt( DOC_EXT );
// Copy .dcm file to .bck. // Copy .dcm file to .bck.
if( !backupFile( docFileName, "bck" ) ) if( !backupFile( docFileName, "bck" ) )
return false; return false;