mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-01 09:01:58 +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:
|
||||
explicit ScopedFile(FILE* file) : m_file(file) {}
|
||||
~ScopedFile() { if (m_file != nullptr) fclose(m_file); }
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
void unscope() { m_file = nullptr; }
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
private:
|
||||
FILE* m_file{ nullptr };
|
||||
};
|
||||
@ -5478,11 +5476,9 @@ void Plater::convert_gcode_to_ascii()
|
||||
if (res != bgcode::EResult::Success) {
|
||||
MessageDialog msg_dlg(this, _L(bgcode::translate_result(res)), _L("Error converting gcode file"), wxICON_INFORMATION | wxOK);
|
||||
msg_dlg.ShowModal();
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
scoped_out_file.unscope();
|
||||
fclose(out_file);
|
||||
boost::nowide::remove(output_file.c_str());
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user