Merge branch 'dk_copy_file'
This commit is contained in:
commit
74d3ca2350
2 changed files with 16 additions and 4 deletions
|
@ -456,11 +456,13 @@ int copy_file(const std::string &from, const std::string &to, const bool with_ch
|
||||||
|
|
||||||
int check_copy(const std::string &origin, const std::string ©)
|
int check_copy(const std::string &origin, const std::string ©)
|
||||||
{
|
{
|
||||||
std::ifstream f1(origin, std::ifstream::in | std::ifstream::binary | std::ifstream::ate);
|
boost::nowide::ifstream f1(origin, std::ifstream::in | std::ifstream::binary | std::ifstream::ate);
|
||||||
std::ifstream f2(copy, std::ifstream::in | std::ifstream::binary | std::ifstream::ate);
|
boost::nowide::ifstream f2(copy, std::ifstream::in | std::ifstream::binary | std::ifstream::ate);
|
||||||
|
|
||||||
if (f1.fail() || f2.fail())
|
if (f1.fail())
|
||||||
return -2;
|
return -4;
|
||||||
|
if (f2.fail())
|
||||||
|
return -5;
|
||||||
|
|
||||||
std::streampos fsize = f1.tellg();
|
std::streampos fsize = f1.tellg();
|
||||||
if (fsize != f2.tellg())
|
if (fsize != f2.tellg())
|
||||||
|
|
|
@ -108,6 +108,16 @@ void BackgroundSlicingProcess::process_fff()
|
||||||
std::string err_msg = "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 " + export_path + ".tmp.";
|
std::string err_msg = "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 " + export_path + ".tmp.";
|
||||||
throw std::runtime_error(_utf8(L(err_msg)));
|
throw std::runtime_error(_utf8(L(err_msg)));
|
||||||
}
|
}
|
||||||
|
else if (with_check && copy_ret_val == -4)
|
||||||
|
{
|
||||||
|
std::string err_msg = "Copying of the temporary G-code has finnished but the original code at "+ m_temp_output_path +" couldn't be opened during copy check. The output G-code is at " + export_path + ".tmp.";
|
||||||
|
throw std::runtime_error(_utf8(L(err_msg)));
|
||||||
|
}
|
||||||
|
else if (with_check && copy_ret_val == -5)
|
||||||
|
{
|
||||||
|
std::string err_msg = "Copying of the temporary G-code has finnished but the exported code couldn't be opened during copy check. The output G-code is at " + export_path + ".tmp.";
|
||||||
|
throw std::runtime_error(_utf8(L(err_msg)));
|
||||||
|
}
|
||||||
else if (copy_ret_val == -3)
|
else if (copy_ret_val == -3)
|
||||||
{
|
{
|
||||||
std::string err_msg = "Renaming of the G-code after copying to the selected destination folder has failed. Current path is " + export_path + ".tmp. Please try exporting again.";
|
std::string err_msg = "Renaming of the G-code after copying to the selected destination folder has failed. Current path is " + export_path + ".tmp. Please try exporting again.";
|
||||||
|
|
Loading…
Reference in a new issue