Eeschema: fix broken generation of the project library cache.
Because the cache is broken, the rescue library was never created after missing library or change in lib.
This was due to the fact the symbol name inside the cache is broken, since commit a5844c9
,
because all illegal chars in symbol name are replaced by '_'.
Unfortunately, in library cache, the ':' (illegal in usual libraries) is used to build the cached symbol name.
so in lib cache, symbol names were broken, making this lib useless.
this fix allows the ':' char in symbol name in lib.
Fixes: lp:1764166
https://bugs.launchpad.net/kicad/+bug/1764166
This commit is contained in:
parent
d2cf2fe61c
commit
2974a2c10a
|
@ -116,11 +116,24 @@ PART_LIB* LIB_ALIAS::GetLib()
|
|||
return shared->GetLib();
|
||||
}
|
||||
|
||||
// Helper function to replace illegal chars in symbol names
|
||||
// they are same as illegal filename chars, but the ':' is allowed
|
||||
// only because it is used to create symbol names in lib cache
|
||||
static void replaceIllegalSymbolNameChars( wxString& aName )
|
||||
{
|
||||
static const wxString illegalSymbolNameChars( "\\/\"<>|" );
|
||||
|
||||
for( wxString::iterator it = aName.begin(); it != aName.end(); ++it )
|
||||
{
|
||||
if( illegalSymbolNameChars.Find( *it ) != wxNOT_FOUND )
|
||||
*it = '_';
|
||||
}
|
||||
}
|
||||
|
||||
void LIB_ALIAS::SetName( const wxString& aName )
|
||||
{
|
||||
name = aName;
|
||||
ReplaceIllegalFileNameChars( name, '_' );
|
||||
replaceIllegalSymbolNameChars( name );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue