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