Eeschema, ExportSymbolsToLibrary(): fix not working replace library.

When exporting symbols of the schematic to a new library, if this library
exists the dialog ask for overwriting it, but it did not work.
Fixed now.
This commit is contained in:
jean-pierre charras 2023-02-05 18:41:00 +01:00
parent 82d9176782
commit fb225acefc
1 changed files with 7 additions and 2 deletions

View File

@ -391,11 +391,16 @@ int SCH_EDITOR_CONTROL::ExportSymbolsToLibrary( const TOOL_EVENT& aEvent )
return 0; return 0;
} }
// if the "new" library is in fact an existing library and the used asked for replacing
// it by the recreated lib, erase it:
if( fn.FileExists() )
wxRemoveFile( fn.GetFullPath() );
if( !mgr.CreateLibrary( fn.GetFullPath(), libTable ) ) if( !mgr.CreateLibrary( fn.GetFullPath(), libTable ) )
{ {
DisplayError( m_frame, wxString::Format( _( "Could not add library '%s'." ), DisplayError( m_frame, wxString::Format( _( "Could not add library '%s'." ),
targetLib ) ); targetLib ) );
return 0; return 0;
} }
} }
else else