Don't hardcode symbol library stub when converting library
Also, make sure options column is set back to blank Fixes https://gitlab.com/kicad/code/kicad/-/issues/16706
This commit is contained in:
parent
85f0dd279c
commit
43a3ed2522
|
@ -910,6 +910,7 @@ void PANEL_SYM_LIB_TABLE::onConvertLegacyLibraries( wxCommandEvent& event )
|
|||
|
||||
m_cur_grid->SetCellValue( row, COL_URI, relPath );
|
||||
m_cur_grid->SetCellValue( row, COL_TYPE, kicadType );
|
||||
m_cur_grid->SetCellValue( row, COL_OPTIONS, wxEmptyString );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -936,15 +937,6 @@ bool PANEL_SYM_LIB_TABLE::convertLibrary( STRING_UTF8_MAP* aOldFileProps, const
|
|||
|
||||
try
|
||||
{
|
||||
// Write a stub file; SaveSymbol() expects something to be there already.
|
||||
FILE_OUTPUTFORMATTER* formatter = new FILE_OUTPUTFORMATTER( aNewFilepath );
|
||||
|
||||
formatter->Print( 0, "(kicad_symbol_lib (version %d) (generator kicad_converter) (generator_version \"%s\")",
|
||||
SEXPR_SYMBOL_LIB_FILE_VERSION, GetMajorMinorVersion().c_str().AsChar() );
|
||||
|
||||
// This will write the file
|
||||
delete formatter;
|
||||
|
||||
oldFilePI->EnumerateSymbolLib( symbols, aOldFilePath, aOldFileProps );
|
||||
|
||||
// Copy non-aliases first so we can build a map from symbols to newSymbols
|
||||
|
@ -971,6 +963,9 @@ bool PANEL_SYM_LIB_TABLE::convertLibrary( STRING_UTF8_MAP* aOldFileProps, const
|
|||
newSymbols.back()->SetParent( symbolMap[ symbol->GetParent().lock().get() ] );
|
||||
}
|
||||
|
||||
// Create a blank library
|
||||
kicadPI->SaveLibrary( aNewFilepath );
|
||||
|
||||
// Finally write out newSymbols
|
||||
for( LIB_SYMBOL* symbol : newSymbols )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue