diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-11-26 21:05:20 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-11-26 21:05:20 +0100 |
| commit | f50bc87e0b7e7a376e2f3430b8f34adf02d8a60f (patch) | |
| tree | f130d6546a9c92d566c825fdbe5a5229dca63912 | |
| parent | 69c26b55f4c87376ead8e64382d50f1a5accf3d0 (diff) | |
Don't crash if preferences ZIP needs to be overwritten during export.
| -rw-r--r-- | src/tools/dcpomatic.cc | 12 |
1 files changed, 11 insertions, 1 deletions
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); } } |
