From 43a3ed2522e6f841ac34c75daac9575f189d73a4 Mon Sep 17 00:00:00 2001 From: Roberto Fernandez Bautista Date: Mon, 22 Jan 2024 22:52:40 +0100 Subject: [PATCH] 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 --- eeschema/dialogs/panel_sym_lib_table.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/eeschema/dialogs/panel_sym_lib_table.cpp b/eeschema/dialogs/panel_sym_lib_table.cpp index e1cfcfadc0..bb80f61a0e 100644 --- a/eeschema/dialogs/panel_sym_lib_table.cpp +++ b/eeschema/dialogs/panel_sym_lib_table.cpp @@ -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 ) {