From 2801aec81cdffd6c4b1631c737d59fb1d2c615fb Mon Sep 17 00:00:00 2001 From: Ian Bassi Date: Wed, 18 Nov 2026 09:27:29 -0300 Subject: [PATCH] Decode the last folder of the open dialogs from UTF-8 The Open project, Open G-code and Load profile dialogs passed the remembered folder, a UTF-8 string, to wxWidgets as if it were in the local code page. On Windows a folder with non-ASCII characters in its name was mangled, and opening the dialog could crash. The other file dialogs already convert it with from_u8(). Ported from Snapmaker/OrcaSlicer@7f4e64294a95d036cff0a77b5f344b016963f9dc Co-authored-by: zackaree-shen --- src/slic3r/GUI/GUI_App.cpp | 4 ++-- src/slic3r/GUI/MainFrame.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index cc74fcdb37..c5a7797fad 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -5365,7 +5365,7 @@ void GUI_App::load_project(wxWindow *parent, wxString& input_file) const input_file.Clear(); wxFileDialog dialog(parent ? parent : GetTopWindow(), _L("Choose one file (3MF):"), - app_config->get_last_dir(), "", + from_u8(app_config->get_last_dir()), "", file_wildcards(FT_PROJECT), wxFD_OPEN | wxFD_FILE_MUST_EXIST); if (dialog.ShowModal() == wxID_OK) @@ -5404,7 +5404,7 @@ void GUI_App::load_gcode(wxWindow* parent, wxString& input_file) const input_file.Clear(); wxFileDialog dialog(parent ? parent : GetTopWindow(), _L("Choose one file (GCODE/3MF):"), - app_config->get_last_dir(), "", + from_u8(app_config->get_last_dir()), "", file_wildcards(FT_GCODE), wxFD_OPEN | wxFD_FILE_MUST_EXIST); if (dialog.ShowModal() == wxID_OK) diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 7824b1534f..7431e3f1d3 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -4250,7 +4250,7 @@ void MainFrame::load_config_file() // if (!wxGetApp().check_and_save_current_preset_changes(_L("Loading profile file"), "", false)) // return; wxFileDialog dlg(this, _L("Select profile to load:"), - !m_last_config.IsEmpty() ? get_dir_name(m_last_config) : wxGetApp().app_config->get_last_dir(), + from_u8(!m_last_config.IsEmpty() ? get_dir_name(m_last_config) : wxGetApp().app_config->get_last_dir()), "config.json", _L("Config files (*.json;*.zip;*.orca_printer;*.orca_bundle;*.orca_filament)|*.json;*.zip;*.orca_printer;*.orca_bundle;*.orca_filament"), wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST); wxArrayString files; if (dlg.ShowModal() != wxID_OK)