From f50bc87e0b7e7a376e2f3430b8f34adf02d8a60f Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 26 Nov 2023 21:05:20 +0100 Subject: Don't crash if preferences ZIP needs to be overwritten during export. --- src/tools/dcpomatic.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/tools') diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index 979672fb4..11181ae58 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -762,7 +762,17 @@ private: ); if (dialog.ShowModal() == wxID_OK) { - save_all_config_as_zip(wx_to_std(dialog.GetPath())); + auto const path = boost::filesystem::path(wx_to_std(dialog.GetPath())); + if (boost::filesystem::exists(path)) { + boost::system::error_code ec; + boost::filesystem::remove(path, ec); + if (ec) { + error_dialog(nullptr, _("Could not remove existing preferences file"), std_to_wx(path.string())); + return; + } + } + + save_all_config_as_zip(path); } } -- cgit v1.2.3