From e6a3e7024da77563257ce4fb2148c764fb4d8da4 Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Wed, 26 Feb 2020 19:20:47 +0000 Subject: [PATCH] Also verify that the .dcm is writable when saving library Fixes https://gitlab.com/kicad/code/kicad/issues/3946 (cherry-picked from b2cc4548785a57030ad796fe0531d56ec3d4af52) --- eeschema/libedit/libedit.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eeschema/libedit/libedit.cpp b/eeschema/libedit/libedit.cpp index 77cd1f6e2d..7d04d875da 100644 --- a/eeschema/libedit/libedit.cpp +++ b/eeschema/libedit/libedit.cpp @@ -726,8 +726,11 @@ bool LIB_EDIT_FRAME::saveLibrary( const wxString& aLibrary, bool aNewFile ) 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. - if( !IsWritable( fn ) ) + if( !IsWritable( fn ) || !IsWritable( docFileName ) ) return false; ClearMsgPanel(); @@ -736,9 +739,6 @@ bool LIB_EDIT_FRAME::saveLibrary( const wxString& aLibrary, bool aNewFile ) if( !backupFile( fn, "bak" ) ) return false; - wxFileName docFileName = fn; - docFileName.SetExt( DOC_EXT ); - // Copy .dcm file to .bck. if( !backupFile( docFileName, "bck" ) ) return false;