Fix of "PrusaSlicer 2.0.0.-rc+ g-code error when importing #2304"
This commit is contained in:
parent
fb6ae5296e
commit
84965dcb44
1 changed files with 4 additions and 2 deletions
|
@ -508,10 +508,12 @@ void ConfigBase::load_from_gcode_file(const std::string &file)
|
|||
boost::nowide::ifstream ifs(file);
|
||||
{
|
||||
const char slic3r_gcode_header[] = "; generated by Slic3r ";
|
||||
const char prusaslicer_gcode_header[] = "; generated by PrusaSlicer ";
|
||||
std::string firstline;
|
||||
std::getline(ifs, firstline);
|
||||
if (strncmp(slic3r_gcode_header, firstline.c_str(), strlen(slic3r_gcode_header)) != 0)
|
||||
throw std::runtime_error("Not a Slic3r generated g-code.");
|
||||
if (strncmp(slic3r_gcode_header, firstline.c_str(), strlen(slic3r_gcode_header)) != 0 &&
|
||||
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);
|
||||
auto file_length = ifs.tellg();
|
||||
|
|
Loading…
Reference in a new issue