Eagle importer: replace invalid character with '_' to match PCB<->SCH

This commit is contained in:
Maciej Suminski 2018-02-16 15:53:25 +01:00
parent e2f82118a2
commit c95340fbaf
3 changed files with 17 additions and 9 deletions

View File

@ -817,7 +817,7 @@ EELEMENT::EELEMENT( wxXmlNode* aElement )
library = parseRequiredAttribute<wxString>( aElement, "library" ); library = parseRequiredAttribute<wxString>( aElement, "library" );
value = parseRequiredAttribute<wxString>( aElement, "value" ); value = parseRequiredAttribute<wxString>( aElement, "value" );
std::string p = parseRequiredAttribute<std::string>( aElement, "package" ); std::string p = parseRequiredAttribute<std::string>( aElement, "package" );
ReplaceIllegalFileNameChars( &p ); ReplaceIllegalFileNameChars( &p, '_' );
package = wxString::FromUTF8( p.c_str() ); package = wxString::FromUTF8( p.c_str() );
x = parseRequiredAttribute<ECOORD>( aElement, "x" ); x = parseRequiredAttribute<ECOORD>( aElement, "x" );
@ -966,16 +966,23 @@ EDEVICE::EDEVICE( wxXmlNode* aDevice )
> >
*/ */
name = parseRequiredAttribute<wxString>( aDevice, "name" ); name = parseRequiredAttribute<wxString>( aDevice, "name" );
package = parseOptionalAttribute<wxString>( aDevice, "package" ); opt_wxString pack = parseOptionalAttribute<wxString>( aDevice, "package" );
NODE_MAP aDeviceChildren = MapChildren(aDevice); if( pack )
wxXmlNode* connectNode = getChildrenNodes(aDeviceChildren, "connects"); {
std::string p( pack->c_str() );
while(connectNode){ ReplaceIllegalFileNameChars( &p, '_' );
connects.push_back(ECONNECT(connectNode)); package.Set( wxString::FromUTF8( p.c_str() ) );
connectNode = connectNode->GetNext();
} }
NODE_MAP aDeviceChildren = MapChildren( aDevice );
wxXmlNode* connectNode = getChildrenNodes( aDeviceChildren, "connects" );
while( connectNode )
{
connects.push_back( ECONNECT( connectNode ) );
connectNode = connectNode->GetNext();
}
} }

View File

@ -285,6 +285,7 @@ public:
void Set( const wxString& aString ) void Set( const wxString& aString )
{ {
m_data = Convert<T>( aString ); m_data = Convert<T>( aString );
m_isAvailable = !aString.IsEmpty();
} }
/** /**

View File

@ -766,7 +766,7 @@ void EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLib, const wxString* aLibName )
const wxString& pack_ref = package->GetAttribute( "name" ); const wxString& pack_ref = package->GetAttribute( "name" );
std::string pack_name( pack_ref ); std::string pack_name( pack_ref );
ReplaceIllegalFileNameChars( &pack_name ); ReplaceIllegalFileNameChars( &pack_name, '_' );
m_xpath->Value( pack_name.c_str() ); m_xpath->Value( pack_name.c_str() );