This commit is contained in:
Enrico Turri 2019-05-21 09:43:14 +02:00
commit 83c06859a6

View File

@ -508,10 +508,12 @@ void ConfigBase::load_from_gcode_file(const std::string &file)
boost::nowide::ifstream ifs(file); boost::nowide::ifstream ifs(file);
{ {
const char slic3r_gcode_header[] = "; generated by Slic3r "; const char slic3r_gcode_header[] = "; generated by Slic3r ";
const char prusaslicer_gcode_header[] = "; generated by PrusaSlicer ";
std::string firstline; std::string firstline;
std::getline(ifs, firstline); std::getline(ifs, firstline);
if (strncmp(slic3r_gcode_header, firstline.c_str(), strlen(slic3r_gcode_header)) != 0) if (strncmp(slic3r_gcode_header, firstline.c_str(), strlen(slic3r_gcode_header)) != 0 &&
throw std::runtime_error("Not a Slic3r generated g-code."); strncmp(prusaslicer_gcode_header, firstline.c_str(), strlen(prusaslicer_gcode_header)) != 0)
throw std::runtime_error("Not a PrusaSlicer / Slic3r PE generated g-code.");
} }
ifs.seekg(0, ifs.end); ifs.seekg(0, ifs.end);
auto file_length = ifs.tellg(); auto file_length = ifs.tellg();