.kicad_sym files: Fix an issue when a symbol name contains a double quote.

This char (accepted in dialog) was escaped in some places, but not all.
So if a symbol name contained a double quote, the lib file was broken.
This commit is contained in:
jean-pierre charras 2020-11-17 12:23:46 +01:00
parent a431fd99ca
commit 993a684959
1 changed files with 5 additions and 2 deletions

View File

@ -1605,8 +1605,11 @@ void SCH_SEXPR_PLUGIN_CACHE::SaveSymbol( LIB_PART* aSymbol, OUTPUTFORMATTER& aFo
for( auto unit : units ) for( auto unit : units )
{ {
aFormatter.Print( aNestLevel + 1, "(symbol \"%s_%d_%d\"\n", name = aFormatter.Quotew( unitName ); // Add quotes and escape chars like ")
unitName.c_str(), unit.m_unit, unit.m_convert ); name.pop_back(); // Remove last char: the quote ending the string.
aFormatter.Print( aNestLevel + 1, "(symbol \%s_%d_%d\"\n",
name.c_str(), unit.m_unit, unit.m_convert );
for( auto item : unit.m_items ) for( auto item : unit.m_items )
saveSymbolDrawItem( item, aFormatter, aNestLevel + 2 ); saveSymbolDrawItem( item, aFormatter, aNestLevel + 2 );