Ask user before overwriting a file when migrating symbol libs.

Fixes https://gitlab.com/kicad/code/kicad/issues/8299
This commit is contained in:
Jeff Young 2021-05-08 23:09:23 +01:00
parent b78ba12739
commit 693fbf9073
1 changed files with 15 additions and 1 deletions

View File

@ -736,7 +736,7 @@ void PANEL_SYM_LIB_TABLE::onConvertLegacyLibraries( wxCommandEvent& event )
{
msg.Printf( _( "Save %d legacy libraries as current format (*.kicad_sym) and "
"replace legacy entries in table?" ),
legacyRows.size() );
(int) legacyRows.size() );
}
if( !IsOK( m_parent, msg ) )
@ -760,6 +760,20 @@ void PANEL_SYM_LIB_TABLE::onConvertLegacyLibraries( wxCommandEvent& event )
wxFileName newLib( resolvedPath );
newLib.SetExt( "kicad_sym" );
if( newLib.Exists() )
{
msg.Printf( _( "File '%s' already exists. Do you want overwrite this file?" ),
newLib.GetFullPath() );
switch( wxMessageBox( msg, _( "Migrate Library" ),
wxYES_NO | wxCANCEL | wxICON_QUESTION, m_parent ) )
{
case wxYES: break;
case wxNO: continue;
case wxCANCEL: return;
}
}
if( convertLibrary( libName, legacyLib.GetFullPath(), newLib.GetFullPath() ) )
{
relPath = NormalizePath( newLib.GetFullPath(), &Pgm().GetLocalEnvVariables(),