diff options
Diffstat (limited to 'src/wx/wx_util.cc')
| -rw-r--r-- | src/wx/wx_util.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc index c9185ec97..db6340031 100644 --- a/src/wx/wx_util.cc +++ b/src/wx/wx_util.cc @@ -463,10 +463,15 @@ maybe_show_splash () return splash; } -boost::filesystem::path +optional<boost::filesystem::path> path_from_file_dialog (wxFileDialog* dialog, string extension) { - return boost::filesystem::path(wx_to_std(dialog->GetPath())).replace_extension(extension); + boost::filesystem::path p(wx_to_std(dialog->GetPath())); + p.replace_extension(extension); + if (boost::filesystem::is_regular_file(p) && !confirm_dialog(dialog, wxString::Format(_("A file named %s already exists. Do you want to replace it?"), std_to_wx(p.filename().string())))) { + return optional<boost::filesystem::path>(); + } + return p; } double |
