Set boost to use utf8 for system messages (in cmake). Fix of #5180.
This commit is contained in:
parent
24a8f832bc
commit
247f3a7dbe
@ -229,7 +229,7 @@ if(WIN32)
|
|||||||
add_definitions(-D_USE_MATH_DEFINES -D_WIN32 -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
|
add_definitions(-D_USE_MATH_DEFINES -D_WIN32 -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
# BOOST_ALL_NO_LIB: Avoid the automatic linking of Boost libraries on Windows. Rather rely on explicit linking.
|
# BOOST_ALL_NO_LIB: Avoid the automatic linking of Boost libraries on Windows. Rather rely on explicit linking.
|
||||||
add_definitions(-DBOOST_ALL_NO_LIB -DBOOST_USE_WINAPI_VERSION=0x601 )
|
add_definitions(-DBOOST_ALL_NO_LIB -DBOOST_USE_WINAPI_VERSION=0x601 -DBOOST_SYSTEM_USE_UTF8 )
|
||||||
endif(MSVC)
|
endif(MSVC)
|
||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
|
|
||||||
|
@ -436,7 +436,7 @@ CopyFileResult copy_file_inner(const std::string& from, const std::string& to, s
|
|||||||
ec.clear();
|
ec.clear();
|
||||||
boost::filesystem::copy_file(source, target, boost::filesystem::copy_option::overwrite_if_exists, ec);
|
boost::filesystem::copy_file(source, target, boost::filesystem::copy_option::overwrite_if_exists, ec);
|
||||||
if (ec) {
|
if (ec) {
|
||||||
error_message = ec.message();
|
error_message = ec.message()/*decode_path(ec.message().c_str())*/;
|
||||||
return FAIL_COPY_FILE;
|
return FAIL_COPY_FILE;
|
||||||
}
|
}
|
||||||
ec.clear();
|
ec.clear();
|
||||||
@ -552,6 +552,7 @@ std::string encode_path(const char *src)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Encode an 8-bit string from a local code page to UTF-8.
|
// Encode an 8-bit string from a local code page to UTF-8.
|
||||||
|
// Multibyte to utf8
|
||||||
std::string decode_path(const char *src)
|
std::string decode_path(const char *src)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
@ -149,30 +149,38 @@ void BackgroundSlicingProcess::process_fff()
|
|||||||
// Perform the final post-processing of the export path by applying the print statistics over the file name.
|
// Perform the final post-processing of the export path by applying the print statistics over the file name.
|
||||||
std::string export_path = m_fff_print->print_statistics().finalize_output_path(m_export_path);
|
std::string export_path = m_fff_print->print_statistics().finalize_output_path(m_export_path);
|
||||||
std::string error_message;
|
std::string error_message;
|
||||||
int copy_ret_val = copy_file(m_temp_output_path, export_path, error_message, m_export_path_on_removable_media);
|
int copy_ret_val = CopyFileResult::SUCCESS;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
copy_ret_val = copy_file(m_temp_output_path, export_path, error_message, m_export_path_on_removable_media);
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
throw Slic3r::ExportError(_utf8(L("Unknown error occured during exporting G-code.")));
|
||||||
|
}
|
||||||
switch (copy_ret_val) {
|
switch (copy_ret_val) {
|
||||||
case SUCCESS: break; // no error
|
case CopyFileResult::SUCCESS: break; // no error
|
||||||
case FAIL_COPY_FILE:
|
case CopyFileResult::FAIL_COPY_FILE:
|
||||||
throw Slic3r::ExportError((boost::format(_utf8(L("Copying of the temporary G-code to the output G-code failed. Maybe the SD card is write locked?\nError message: %1%"))) % error_message).str());
|
throw Slic3r::ExportError((boost::format(_utf8(L("Copying of the temporary G-code to the output G-code failed. Maybe the SD card is write locked?\nError message: %1%"))) % error_message).str());
|
||||||
break;
|
break;
|
||||||
case FAIL_FILES_DIFFERENT:
|
case CopyFileResult::FAIL_FILES_DIFFERENT:
|
||||||
throw Slic3r::ExportError((boost::format(_utf8(L("Copying of the temporary G-code to the output G-code failed. There might be problem with target device, please try exporting again or using different device. The corrupted output G-code is at %1%.tmp."))) % export_path).str());
|
throw Slic3r::ExportError((boost::format(_utf8(L("Copying of the temporary G-code to the output G-code failed. There might be problem with target device, please try exporting again or using different device. The corrupted output G-code is at %1%.tmp."))) % export_path).str());
|
||||||
break;
|
break;
|
||||||
case FAIL_RENAMING:
|
case CopyFileResult::FAIL_RENAMING:
|
||||||
throw Slic3r::ExportError((boost::format(_utf8(L("Renaming of the G-code after copying to the selected destination folder has failed. Current path is %1%.tmp. Please try exporting again."))) % export_path).str());
|
throw Slic3r::ExportError((boost::format(_utf8(L("Renaming of the G-code after copying to the selected destination folder has failed. Current path is %1%.tmp. Please try exporting again."))) % export_path).str());
|
||||||
break;
|
break;
|
||||||
case FAIL_CHECK_ORIGIN_NOT_OPENED:
|
case CopyFileResult::FAIL_CHECK_ORIGIN_NOT_OPENED:
|
||||||
throw Slic3r::ExportError((boost::format(_utf8(L("Copying of the temporary G-code has finished but the original code at %1% couldn't be opened during copy check. The output G-code is at %2%.tmp."))) % m_temp_output_path % export_path).str());
|
throw Slic3r::ExportError((boost::format(_utf8(L("Copying of the temporary G-code has finished but the original code at %1% couldn't be opened during copy check. The output G-code is at %2%.tmp."))) % m_temp_output_path % export_path).str());
|
||||||
break;
|
break;
|
||||||
case FAIL_CHECK_TARGET_NOT_OPENED:
|
case CopyFileResult::FAIL_CHECK_TARGET_NOT_OPENED:
|
||||||
throw Slic3r::ExportError((boost::format(_utf8(L("Copying of the temporary G-code has finished but the exported code couldn't be opened during copy check. The output G-code is at %1%.tmp."))) % export_path).str());
|
throw Slic3r::ExportError((boost::format(_utf8(L("Copying of the temporary G-code has finished but the exported code couldn't be opened during copy check. The output G-code is at %1%.tmp."))) % export_path).str());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw Slic3r::RuntimeError(_utf8(L("Unknown error occured during exporting G-code.")));
|
throw Slic3r::ExportError(_utf8(L("Unknown error occured during exporting G-code.")));
|
||||||
BOOST_LOG_TRIVIAL(error) << "Unexpected fail code(" << (int)copy_ret_val << ") durring copy_file() to " << export_path << ".";
|
BOOST_LOG_TRIVIAL(error) << "Unexpected fail code(" << (int)copy_ret_val << ") durring copy_file() to " << export_path << ".";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "copy_ret_val is ok";
|
||||||
m_print->set_status(95, _utf8(L("Running post-processing scripts")));
|
m_print->set_status(95, _utf8(L("Running post-processing scripts")));
|
||||||
run_post_process_scripts(export_path, m_fff_print->config());
|
run_post_process_scripts(export_path, m_fff_print->config());
|
||||||
m_print->set_status(100, (boost::format(_utf8(L("G-code file exported to %1%"))) % export_path).str());
|
m_print->set_status(100, (boost::format(_utf8(L("G-code file exported to %1%"))) % export_path).str());
|
||||||
|
Loading…
Reference in New Issue
Block a user