Handle legacy libraries with escaped symbol names.

Fixes https://gitlab.com/kicad/code/kicad/issues/14057
This commit is contained in:
Jeff Young 2023-04-15 17:46:32 +01:00
parent d4b4abd001
commit b74d964bff
3 changed files with 10 additions and 2 deletions

View File

@ -159,9 +159,12 @@ wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext )
else
converted += c;
}
else if( aContext == CTX_LIBID )
else if( aContext == CTX_LIBID || aContext == CTX_LEGACY_LIBID )
{
if( c == '\\' )
// We no longer escape '/' in LIB_IDs, but we used to
if( c == '/' && aContext == CTX_LEGACY_LIBID )
converted += wxT( "{slash}" );
else if( c == '\\' )
converted += wxT( "{backslash}" );
else if( c == '<' )
converted += wxT( "{lt}" );

View File

@ -1493,6 +1493,10 @@ LIB_SYMBOL* SCH_SEXPR_PLUGIN::LoadSymbol( const wxString& aLibraryPath, const wx
LIB_SYMBOL_MAP::const_iterator it = m_cache->m_symbols.find( aSymbolName );
// We no longer escape '/' in symbol names, but we used to.
if( it == m_cache->m_symbols.end() && aSymbolName.Contains( '/' ) )
it = m_cache->m_symbols.find( EscapeString( aSymbolName, CTX_LEGACY_LIBID ) );
if( it == m_cache->m_symbols.end() )
return nullptr;

View File

@ -53,6 +53,7 @@ enum ESCAPE_CONTEXT
{
CTX_NETNAME,
CTX_LIBID,
CTX_LEGACY_LIBID,
CTX_IPC,
CTX_QUOTED_STR,
CTX_JS_STR,