This commit is contained in:
Filip Sykala - NTB T15p 2023-01-26 16:43:27 +01:00
commit 23e7945a38
2 changed files with 16 additions and 4 deletions

View File

@ -1447,9 +1447,12 @@ bool PageDownloader::on_finish_downloader() const
bool DownloaderUtils::Worker::perform_register() bool DownloaderUtils::Worker::perform_register()
{ {
//boost::filesystem::path chosen_dest/*(path_text_ctrl->GetValue());*/(boost::nowide::narrow(path_text_ctrl->GetValue())); boost::filesystem::path aux_dest (GUI::into_u8(path_name()));
boost::filesystem::path chosen_dest (GUI::format(path_name()));
boost::system::error_code ec; boost::system::error_code ec;
boost::filesystem::path chosen_dest = boost::filesystem::absolute(aux_dest, ec);
if(ec)
chosen_dest = aux_dest;
ec.clear();
if (chosen_dest.empty() || !boost::filesystem::is_directory(chosen_dest, ec) || ec) { if (chosen_dest.empty() || !boost::filesystem::is_directory(chosen_dest, ec) || ec) {
std::string err_msg = GUI::format("%1%\n\n%2%",_L("Chosen directory for downloads does not Exists.") ,chosen_dest.string()); std::string err_msg = GUI::format("%1%\n\n%2%",_L("Chosen directory for downloads does not Exists.") ,chosen_dest.string());
BOOST_LOG_TRIVIAL(error) << err_msg; BOOST_LOG_TRIVIAL(error) << err_msg;

View File

@ -9,6 +9,8 @@
#include <iostream> #include <iostream>
#include "format.hpp" #include "format.hpp"
#include "GUI.hpp"
#include "I18N.hpp"
namespace Slic3r { namespace Slic3r {
namespace GUI { namespace GUI {
@ -168,7 +170,14 @@ void FileGet::priv::get_perform()
else else
file = fopen(temp_path_wstring.c_str(), "ab"); file = fopen(temp_path_wstring.c_str(), "ab");
assert(file != NULL); //assert(file != NULL);
if (file == NULL) {
wxCommandEvent* evt = new wxCommandEvent(EVT_DWNLDR_FILE_ERROR);
evt->SetString(GUI::format_wxstr(_L("Can't create file at %1%."), temp_path_wstring));
evt->SetInt(m_id);
m_evt_handler->QueueEvent(evt);
return;
}
std:: string range_string = std::to_string(m_written) + "-"; std:: string range_string = std::to_string(m_written) + "-";
@ -244,7 +253,7 @@ void FileGet::priv::get_perform()
if (file != NULL) if (file != NULL)
fclose(file); fclose(file);
wxCommandEvent* evt = new wxCommandEvent(EVT_DWNLDR_FILE_ERROR); wxCommandEvent* evt = new wxCommandEvent(EVT_DWNLDR_FILE_ERROR);
evt->SetString(error); evt->SetString(GUI::from_u8(error));
evt->SetInt(m_id); evt->SetInt(m_id);
m_evt_handler->QueueEvent(evt); m_evt_handler->QueueEvent(evt);
}) })