KiCad variable resolution is case sensitive OR all-upper-case.

Bring Altium variable references (which are case-insensitive) in as
all-upper-case.

Fixes https://gitlab.com/kicad/code/kicad/issues/6256
This commit is contained in:
Jeff Young 2021-07-05 11:04:19 +01:00
parent 26df39e71a
commit 6cc564aead
2 changed files with 8 additions and 6 deletions

View File

@ -79,7 +79,7 @@ wxString AltiumPropertyToKiCadString( const wxString& aString )
// https://www.altium.com/documentation/altium-designer/sch-obj-textstringtext-string-ad#!special-strings
wxString AltiumSpecialStringsToKiCadVariables( const wxString& aString,
const altium_override_map_t& aOverride )
const altium_override_map_t& aOverrides )
{
if( aString.IsEmpty() || aString.at( 0 ) != '=' )
{
@ -116,15 +116,17 @@ wxString AltiumSpecialStringsToKiCadVariables( const wxString& aStr
if( !specialString.IsEmpty() )
{
auto variableOverride = aOverride.find( specialString );
auto overrideIt = aOverrides.find( specialString );
if( variableOverride == aOverride.end() )
if( overrideIt != aOverrides.end() )
{
result += wxString::Format( wxT( "${%s}" ), specialString );
result += overrideIt->second;
}
else
{
result += variableOverride->second;
// Note: Altium variable references are case-insensitive. KiCad matches
// case-senstive OR to all-upper-case, so make the references all-upper-case.
result += wxString::Format( wxT( "${%s}" ), specialString.Upper() );
}
}
start = delimiter + 1;

View File

@ -48,6 +48,6 @@ LIB_ID AltiumToKiCadLibID( wxString aLibName, wxString aLibReference );
wxString AltiumPropertyToKiCadString( const wxString& aString );
wxString AltiumSpecialStringsToKiCadVariables( const wxString& aString,
const altium_override_map_t& aOverride );
const altium_override_map_t& aOverrides );
#endif //ALTIUM_PARSER_UTILS_H