From ddba05828d83434dd232df2dec2e3f118c509c39 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Thu, 29 Aug 2024 16:02:38 +0200 Subject: [PATCH] Fixed couple of encoding issues --- src/slic3r/GUI/DownloaderFileGet.cpp | 11 +++-------- src/slic3r/GUI/WifiConfigDialog.cpp | 2 +- src/slic3r/Utils/AppUpdater.cpp | 3 +-- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/slic3r/GUI/DownloaderFileGet.cpp b/src/slic3r/GUI/DownloaderFileGet.cpp index cbb0ae4663..172f734b67 100644 --- a/src/slic3r/GUI/DownloaderFileGet.cpp +++ b/src/slic3r/GUI/DownloaderFileGet.cpp @@ -176,26 +176,21 @@ void FileGet::priv::get_perform() } boost::filesystem::path dest_path = m_dest_folder / m_filename; - - wxString temp_path_wstring(m_tmp_path.wstring()); - - //std::cout << "dest_path: " << dest_path.string() << std::endl; - //std::cout << "m_tmp_path: " << m_tmp_path.string() << std::endl; BOOST_LOG_TRIVIAL(info) << GUI::format("Starting download from %1% to %2%. Temp path is %3%",m_url, dest_path, m_tmp_path); FILE* file; // open file for writting if (m_written == 0) - file = fopen(into_u8(temp_path_wstring).c_str(), "wb"); + file = boost::nowide::fopen(m_tmp_path.string().c_str(), "wb"); else - file = fopen(into_u8(temp_path_wstring).c_str(), "ab"); + file = boost::nowide::fopen(m_tmp_path.string().c_str(), "ab"); //assert(file != NULL); if (file == NULL) { wxCommandEvent* evt = new wxCommandEvent(EVT_DWNLDR_FILE_ERROR); // TRN %1% = file path - evt->SetString(GUI::format_wxstr(_L("Can't create file at %1%"), temp_path_wstring)); + evt->SetString(GUI::format_wxstr(_L("Can't create file at %1%"), m_tmp_path.string())); evt->SetInt(m_id); m_evt_handler->QueueEvent(evt); return; diff --git a/src/slic3r/GUI/WifiConfigDialog.cpp b/src/slic3r/GUI/WifiConfigDialog.cpp index d40293b3f9..0edcd0552f 100644 --- a/src/slic3r/GUI/WifiConfigDialog.cpp +++ b/src/slic3r/GUI/WifiConfigDialog.cpp @@ -294,7 +294,7 @@ void WifiConfigDialog::on_ok(wxCommandEvent& e) m_used_path = boost::nowide::widen(file_path.string()); FILE* file; - file = fopen(file_path.string().c_str(), "w"); + file = boost::nowide::fopen(file_path.string().c_str(), "w"); if (file == NULL) { BOOST_LOG_TRIVIAL(error) << "Failed to write to file " << file_path; // TODO show error diff --git a/src/slic3r/Utils/AppUpdater.cpp b/src/slic3r/Utils/AppUpdater.cpp index 9c12eafd16..8089e952f1 100644 --- a/src/slic3r/Utils/AppUpdater.cpp +++ b/src/slic3r/Utils/AppUpdater.cpp @@ -221,8 +221,7 @@ boost::filesystem::path AppUpdater::priv::download_file(const DownloadAppData& d boost::filesystem::path tmp_path = dest_path; tmp_path += format(".%1%%2%", std::to_string(GUI::GLCanvas3D::timestamp_now()), ".download"); FILE* file; - wxString temp_path_wstring(tmp_path.wstring()); - file = fopen(GUI::into_u8(temp_path_wstring).c_str(), "wb"); + file = boost::nowide::fopen(tmp_path.string().c_str(), "wb"); assert(file != NULL); if (file == NULL) { std::string line1 = GUI::format(_u8L("Download from %1% couldn't start:"), data.url);