From 0d7e53badb4c62ff1a8638ca916109b524f52b6c Mon Sep 17 00:00:00 2001 From: bubnikv Date: Thu, 3 Jan 2019 12:32:13 +0100 Subject: [PATCH] Fix of 1.42.0-Alpha1 won't open from self contained folder #1500 Added some missing UTF8 to wxString path explicit conversions. --- src/slic3r/GUI/GLTexture.cpp | 2 +- src/slic3r/GUI/GUI_App.cpp | 6 +++--- src/slic3r/GUI/wxExtensions.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/GLTexture.cpp b/src/slic3r/GUI/GLTexture.cpp index 235e3d93b..0ac7e983e 100644 --- a/src/slic3r/GUI/GLTexture.cpp +++ b/src/slic3r/GUI/GLTexture.cpp @@ -36,7 +36,7 @@ bool GLTexture::load_from_file(const std::string& filename, bool generate_mipmap // Load a PNG with an alpha channel. wxImage image; - if (!image.LoadFile(filename, wxBITMAP_TYPE_PNG)) + if (!image.LoadFile(wxString::FromUTF8(filename), wxBITMAP_TYPE_PNG)) { reset(); return false; diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 0138c1229..b1ecef7df 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -459,7 +459,7 @@ bool GUI_App::select_language( wxArrayString & names, { m_wxLocale = new wxLocale; m_wxLocale->Init(identifiers[index]); - m_wxLocale->AddCatalogLookupPathPrefix(localization_dir()); + m_wxLocale->AddCatalogLookupPathPrefix(wxString::FromUTF8(localization_dir())); m_wxLocale->AddCatalog(/*GetAppName()*/"Slic3rPE"); wxSetlocale(LC_NUMERIC, "C"); #ifdef WIN32 @@ -489,7 +489,7 @@ bool GUI_App::load_language() { m_wxLocale = new wxLocale; m_wxLocale->Init(identifiers[i]); - m_wxLocale->AddCatalogLookupPathPrefix(localization_dir()); + m_wxLocale->AddCatalogLookupPathPrefix(wxString::FromUTF8(localization_dir())); m_wxLocale->AddCatalog(/*GetAppName()*/"Slic3rPE"); wxSetlocale(LC_NUMERIC, "C"); #ifdef WIN32 @@ -519,7 +519,7 @@ void GUI_App::get_installed_languages(wxArrayString & names, wxArrayLong & ident names.Clear(); identifiers.Clear(); - wxDir dir(localization_dir()); + wxDir dir(wxString::FromUTF8(localization_dir())); wxString filename; const wxLanguageInfo * langinfo; wxString name = wxLocale::GetLanguageName(wxLANGUAGE_DEFAULT); diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index dc917f875..6ea47b45b 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -37,7 +37,7 @@ wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxString& description, std::function cb, const std::string& icon, wxEvtHandler* event_handler) { - const wxBitmap& bmp = !icon.empty() ? wxBitmap(Slic3r::var(icon), wxBITMAP_TYPE_PNG) : wxNullBitmap; + const wxBitmap& bmp = !icon.empty() ? wxBitmap(wxString::FromUTF8(Slic3r::var(icon)), wxBITMAP_TYPE_PNG) : wxNullBitmap; return append_menu_item(menu, id, string, description, cb, bmp, event_handler); } @@ -48,7 +48,7 @@ wxMenuItem* append_submenu(wxMenu* menu, wxMenu* sub_menu, int id, const wxStrin wxMenuItem* item = new wxMenuItem(menu, id, string, description); if (!icon.empty()) - item->SetBitmap(wxBitmap(Slic3r::var(icon), wxBITMAP_TYPE_PNG)); + item->SetBitmap(wxBitmap(wxString::FromUTF8(Slic3r::var(icon)), wxBITMAP_TYPE_PNG)); item->SetSubMenu(sub_menu); menu->Append(item);