Fixed couple of encoding issues

This commit is contained in:
Lukas Matena 2024-08-29 16:02:38 +02:00
parent abea96fd8a
commit ddba05828d
3 changed files with 5 additions and 11 deletions

View File

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

View File

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

View File

@ -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);