mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-02 19:30:37 +08:00
Delete output file when gcode conversion fails
This commit is contained in:
parent
f02e8e3438
commit
2cde917f11
@ -5442,9 +5442,7 @@ void Plater::convert_gcode_to_ascii()
|
|||||||
public:
|
public:
|
||||||
explicit ScopedFile(FILE* file) : m_file(file) {}
|
explicit ScopedFile(FILE* file) : m_file(file) {}
|
||||||
~ScopedFile() { if (m_file != nullptr) fclose(m_file); }
|
~ScopedFile() { if (m_file != nullptr) fclose(m_file); }
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
void unscope() { m_file = nullptr; }
|
void unscope() { m_file = nullptr; }
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
private:
|
private:
|
||||||
FILE* m_file{ nullptr };
|
FILE* m_file{ nullptr };
|
||||||
};
|
};
|
||||||
@ -5478,11 +5476,9 @@ void Plater::convert_gcode_to_ascii()
|
|||||||
if (res != bgcode::EResult::Success) {
|
if (res != bgcode::EResult::Success) {
|
||||||
MessageDialog msg_dlg(this, _L(bgcode::translate_result(res)), _L("Error converting gcode file"), wxICON_INFORMATION | wxOK);
|
MessageDialog msg_dlg(this, _L(bgcode::translate_result(res)), _L("Error converting gcode file"), wxICON_INFORMATION | wxOK);
|
||||||
msg_dlg.ShowModal();
|
msg_dlg.ShowModal();
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
scoped_out_file.unscope();
|
scoped_out_file.unscope();
|
||||||
fclose(out_file);
|
fclose(out_file);
|
||||||
boost::nowide::remove(output_file.c_str());
|
boost::nowide::remove(output_file.c_str());
|
||||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user