Make sure to translate UTF8 std::string to wchars for wxString.

Fixes https://gitlab.com/kicad/code/kicad/issues/5024
This commit is contained in:
Jeff Young 2020-07-31 14:47:56 +01:00
parent 2d9b0b255b
commit 6e4d4401ae
2 changed files with 10 additions and 7 deletions

View File

@ -158,7 +158,8 @@ bool JSON_SETTINGS::LoadFromFile( const std::string& aDirectory )
else else
{ {
wxString dir( aDirectory.c_str(), wxConvUTF8 ); wxString dir( aDirectory.c_str(), wxConvUTF8 );
path.Assign( dir, m_filename, getFileExt() ); wxString name( m_filename.c_str(), wxConvUTF8 );
path.Assign( dir, name, getFileExt() );
} }
if( !path.Exists() ) if( !path.Exists() )

View File

@ -80,7 +80,8 @@ public:
AppSettings* ret = nullptr; AppSettings* ret = nullptr;
auto it = std::find_if( m_settings.begin(), m_settings.end(), auto it = std::find_if( m_settings.begin(), m_settings.end(),
[]( const std::unique_ptr<JSON_SETTINGS>& aSettings ) { []( const std::unique_ptr<JSON_SETTINGS>& aSettings )
{
return dynamic_cast<AppSettings*>( aSettings.get() ); return dynamic_cast<AppSettings*>( aSettings.get() );
} ); } );
@ -105,12 +106,13 @@ public:
{ {
std::vector<COLOR_SETTINGS*> ret; std::vector<COLOR_SETTINGS*> ret;
for( const auto& el : m_color_settings ) for( const std::pair<const wxString, COLOR_SETTINGS*>& entry : m_color_settings )
ret.push_back( el.second ); ret.push_back( entry.second );
std::sort( ret.begin(), ret.end(), []( COLOR_SETTINGS* a, COLOR_SETTINGS* b ) { std::sort( ret.begin(), ret.end(), []( COLOR_SETTINGS* a, COLOR_SETTINGS* b )
return a->GetName() < b->GetName(); {
} ); return a->GetName() < b->GetName();
} );
return ret; return ret;
} }