From 73065641c01604c2a05c377dd83440948c6d0fe4 Mon Sep 17 00:00:00 2001 From: "chunmao.guo" Date: Tue, 12 Sep 2023 15:59:16 +0800 Subject: [PATCH] FIX: [STUDIO-4387] fix extension of save project name Change-Id: Ie287abc4c65fab134b9bf1ff24baf0dd36b728df Jira: STUDIO-4387 --- src/slic3r/GUI/Plater.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 6ba3423ea..ce6858dd7 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -4191,6 +4191,20 @@ wxString Plater::priv::get_export_file(GUI::FileType file_type) wxString out_path = dlg.GetPath(); fs::path path(into_path(out_path)); +#ifdef __WXMSW__ + if (path.extension() != output_file.extension()) { + out_path += output_file.extension().string(); + boost::system::error_code ec; + if (boost::filesystem::exists(into_u8(out_path), ec)) { + auto result = MessageBox(q->GetHandle(), + wxString::Format(_L("The file %s already exists\nDo you want to replace it?"), out_path), + _L("Comfirm Save As"), + MB_YESNO | MB_ICONWARNING); + if (result != IDYES) + return wxEmptyString; + } + } +#endif wxGetApp().app_config->update_last_output_dir(path.parent_path().string()); return out_path;