From 57ba953b2e9aefa54bb679291a7563a383d72acc Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Mon, 14 Dec 2020 11:05:12 +0100 Subject: [PATCH] PresetUpdater - exceptions reformatted, not throwing an exception on Linux when changing file attributes, as changing file attributes may fail when writing onto FAT file system, which does not support some of the common Unix file attributes. --- src/slic3r/Utils/PresetUpdater.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/slic3r/Utils/PresetUpdater.cpp b/src/slic3r/Utils/PresetUpdater.cpp index 4c5075e23..21eea9428 100644 --- a/src/slic3r/Utils/PresetUpdater.cpp +++ b/src/slic3r/Utils/PresetUpdater.cpp @@ -65,17 +65,32 @@ void copy_file_fix(const fs::path& source, const fs::path& target,const std::str boost::system::error_code ec; if (fs::exists(target)) { fs::permissions(target, perms, ec); - if(ec) - throw Slic3r::CriticalException((boost::format(_utf8(L("Copying of file %1% to %2% failed. Permissions fail at target file before copying.\nError message : %3%\n This error happend during %4% phase."))) % source % target % ec.message() % caller_function_name).str()); + if (ec) { + std::string msg = GUI::format( + _L("Copying of file %1% to %2% failed. Permissions fail at target file before copying.\n" + "Error message : %3%\n This error happend during %4% phase."), + source, target, ec.message(), caller_function_name); +#if defined(__APPLE__) || defined(_WIN32) + throw Slic3r::CriticalException(msg); +#else + BOOST_LOG_TRIVIAL(debug) << msg; +#endif + } } ec.clear(); fs::copy_file(source, target, fs::copy_option::overwrite_if_exists, ec); if (ec) - throw Slic3r::CriticalException((boost::format(_utf8(L("Copying of file %1% to %2% failed.\nError message : %3%\n Copying was triggered by function: %4%"))) % source % target % ec.message() % caller_function_name).str()); + throw Slic3r::CriticalException(GUI::format( + _L("Copying of file %1% to %2% failed.\n" + "Error message : %3%\nCopying was triggered by function: %4%"), + source, target, ec.message(), caller_function_name)); ec.clear(); fs::permissions(target, perms, ec); if (ec) - throw Slic3r::CriticalException((boost::format(_utf8(L("Copying of file %1% to %2% failed. Permissions fail at target file after copying.\nError message : %3%\n Copying was triggered by function: %4%"))) % source % target % ec.message() % caller_function_name).str()); + throw Slic3r::CriticalException(GUI::format( + _L("Copying of file %1% to %2% failed. Permissions fail at target file after copying.\n" + "Error message : %3%\nCopying was triggered by function: %4%"), + source, target, ec.message(), caller_function_name)); } struct Update