mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-04-06 00:32:05 +02:00
Fix non-ASCII path corruption on Windows using from_path() helper (#13036)
This commit is contained in:
@@ -7949,11 +7949,12 @@ bool GUI_App::check_url_association(std::wstring url_prefix, std::wstring& reg_b
|
||||
if (!key_full.Exists()) {
|
||||
return false;
|
||||
}
|
||||
reg_bin = key_full.QueryDefaultValue().ToStdWstring();
|
||||
wxString reg_value = key_full.QueryDefaultValue();
|
||||
reg_bin = reg_value.ToStdWstring();
|
||||
|
||||
boost::filesystem::path binary_path(boost::filesystem::canonical(boost::dll::program_location()));
|
||||
std::wstring key_string = L"\"" + binary_path.wstring() + L"\" \"%1\"";
|
||||
return key_string == reg_bin;
|
||||
wxString key_string = "\"" + from_path(binary_path) + "\" \"%1\"";
|
||||
return key_string == reg_value;
|
||||
#else
|
||||
return false;
|
||||
#endif // WIN32
|
||||
@@ -7963,12 +7964,10 @@ void GUI_App::associate_url(std::wstring url_prefix)
|
||||
{
|
||||
#ifdef WIN32
|
||||
boost::filesystem::path binary_path(boost::filesystem::canonical(boost::dll::program_location()));
|
||||
// the path to binary needs to be correctly saved in string with respect to localized characters
|
||||
wxString wbinary = wxString::FromUTF8(binary_path.string());
|
||||
std::string binary_string = (boost::format("%1%") % wbinary).str();
|
||||
BOOST_LOG_TRIVIAL(info) << "Downloader registration: Path of binary: " << binary_string;
|
||||
wxString wbinary = from_path(binary_path);
|
||||
BOOST_LOG_TRIVIAL(info) << "Downloader registration: Path of binary: " << wbinary.ToUTF8().data();
|
||||
|
||||
std::string key_string = "\"" + binary_string + "\" \"%1\"";
|
||||
wxString key_string = "\"" + wbinary + "\" \"%1\"";
|
||||
|
||||
wxRegKey key_first(wxRegKey::HKCU, "Software\\Classes\\" + url_prefix);
|
||||
wxRegKey key_full(wxRegKey::HKCU, "Software\\Classes\\" + url_prefix + "\\shell\\open\\command");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "HMS.hpp"
|
||||
|
||||
#include "GUI.hpp"
|
||||
#include "DeviceManager.hpp"
|
||||
#include "DeviceCore/DevManager.h"
|
||||
#include "DeviceCore/DevUtil.h"
|
||||
@@ -567,7 +568,7 @@ wxImage HMSQuery::query_image_from_local(const wxString& image_name)
|
||||
{
|
||||
const fs::path& image_path = entry.path();
|
||||
const fs::path& image_name = fs::relative(image_path, local_img_dir);
|
||||
m_hms_local_images[image_name.string()] = wxImage(wxString::FromUTF8(image_path.string()));
|
||||
m_hms_local_images[from_path(image_name)] = wxImage(from_path(image_path));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12112,9 +12112,9 @@ void Plater::import_model_id(wxString download_info)
|
||||
/* load project */
|
||||
// Orca: If download is a zip file, treat it as if file has been drag and dropped on the plater
|
||||
if (target_path.extension() == ".zip")
|
||||
{ wxArrayString arr; arr.Add(wxString::FromUTF8(target_path.string())); this->load_files(arr); }
|
||||
{ wxArrayString arr; arr.Add(from_path(target_path)); this->load_files(arr); }
|
||||
else
|
||||
this->load_project(target_path.wstring());
|
||||
this->load_project(from_path(target_path));
|
||||
/*BBS set project info after load project, project info is reset in load project */
|
||||
//p->project.project_model_id = model_id;
|
||||
//p->project.project_design_id = design_id;
|
||||
|
||||
@@ -1541,7 +1541,7 @@ void SendToPrinterDialog::set_default()
|
||||
}
|
||||
|
||||
fs::path filename_path(filename.c_str());
|
||||
m_current_project_name = wxString::FromUTF8(filename_path.filename().string());
|
||||
m_current_project_name = from_path(filename_path.filename());
|
||||
|
||||
//unsupported character filter
|
||||
m_current_project_name = from_u8(filter_characters(m_current_project_name.ToUTF8().data(), "<>[]:/\\|?*\""));
|
||||
|
||||
@@ -404,7 +404,7 @@ WipingDialog::WipingDialog(wxWindow* parent, const int max_flush_volume) :
|
||||
main_sizer->Add(m_webview, 1, wxEXPAND);
|
||||
|
||||
fs::path filepath = fs::path(resources_dir()) / "web/flush/WipingDialog.html";
|
||||
wxString filepath_str = wxString::FromUTF8(filepath.string());
|
||||
wxString filepath_str = from_path(filepath);
|
||||
wxFileName fn(filepath_str);
|
||||
if(fn.FileExists()) {
|
||||
wxString url = wxFileSystem::FileNameToURL(fn);
|
||||
|
||||
Reference in New Issue
Block a user