From 2cde917f11cbd83e3a2820fd6b7b592950c1fcf3 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Thu, 27 Jul 2023 10:22:22 +0200 Subject: [PATCH] Delete output file when gcode conversion fails --- src/slic3r/GUI/Plater.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 22076aadff..13330199db 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -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; } }