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@7f4e64294a

Co-authored-by: zackaree-shen <zackary_shen@qq.com>
This commit is contained in:
Ian Bassiandzackaree-shen committed 2026-11-30 14:12:40 -03:00
1 parent dc9ef93046
commit 2801aec81c
2 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -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)