diff --git a/src/libslic3r/GCode/PostProcessor.cpp b/src/libslic3r/GCode/PostProcessor.cpp index 27b2254e9..89456dfca 100644 --- a/src/libslic3r/GCode/PostProcessor.cpp +++ b/src/libslic3r/GCode/PostProcessor.cpp @@ -2,6 +2,7 @@ #include "libslic3r/Utils.hpp" #include "libslic3r/format.hpp" +#include "libslic3r/I18N.hpp" #include #include @@ -19,6 +20,11 @@ #include #include +//! macro used to mark string used at localization, +//! return same string +#define L(s) (s) +#define _(s) Slic3r::I18N::translate(s) + // https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command-line-arguments-the-wrong-way/ // This routine appends the given argument to a command line such that CommandLineToArgvW will return the argument string unchanged. // Arguments in a command line should be separated by spaces; this function does not add these spaces. @@ -278,6 +284,15 @@ bool run_post_process_scripts(std::string &src_path, bool make_copy, const std:: delete_copy(); throw Slic3r::RuntimeError(msg); } + if (! boost::filesystem::exists(gcode_file)) { + const std::string msg = (boost::format(_( + "Post-processing script %1% failed.\n\n" + "The post-processing script is expected to change the G-code file %2% in place, but the G-code file was deleted and likely saved under a new name.\n" + "Please adjust the post-processing script to change the G-code in place and consult the manual on how to optionally rename the post-processed G-code file.\n")) + % script % path).str(); + BOOST_LOG_TRIVIAL(error) << msg; + throw Slic3r::RuntimeError(msg); + } } } if (boost::filesystem::exists(path_output_name)) {