From 9624ef4f2ea1608f2d650e0910e1e1ee21dceeee Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 24 Oct 2018 21:43:42 +0100 Subject: [PATCH] Don't blindly overwrite footprints when doing a Save As. --- pcbnew/footprint_libraries_utils.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pcbnew/footprint_libraries_utils.cpp b/pcbnew/footprint_libraries_utils.cpp index 08a3a1c094..5da7db8c75 100644 --- a/pcbnew/footprint_libraries_utils.cpp +++ b/pcbnew/footprint_libraries_utils.cpp @@ -948,6 +948,18 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintAs( MODULE* aModule ) bool module_exists = tbl->FootprintExists( libraryName, footprintName ); + if( module_exists ) + { + wxString msg = wxString::Format( _( "Footprint %s already exists in %s." ), + footprintName, + libraryName ); + KIDIALOG dlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING ); + dlg.SetOKLabel( _( "Overwrite" ) ); + + if( dlg.ShowModal() == wxID_CANCEL ) + return false; + } + if( !saveFootprintInLibrary( aModule, libraryName ) ) return false;