X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Ftools%2Fdcpomatic.cc;h=5bd8b8def425a677e50c45bce2d5a333e8dcc8ef;hb=b73b0d73dc2894d8a746f930f1025301e3e712ad;hp=0ed65da8d82291721eac8a2b50355554cf63d9ba;hpb=c9adcaa9bed0ade0c763c207ee6305a8f397fe41;p=dcpomatic.git diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index 0ed65da8d..5bd8b8def 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -91,6 +91,7 @@ #include "lib/version.h" #include "lib/video_content.h" #include +#include #include #include LIBDCP_DISABLE_WARNINGS @@ -475,7 +476,7 @@ public: } catch (FileNotFoundError& e) { auto const dir = e.file().parent_path(); - if (boost::filesystem::exists(dir / "ASSETMAP") || boost::filesystem::exists(dir / "ASSETMAP.xml")) { + if (dcp::filesystem::exists(dir / "ASSETMAP") || dcp::filesystem::exists(dir / "ASSETMAP.xml")) { error_dialog ( this, _("Could not open this folder as a DCP-o-matic project."), _("It looks like you are trying to open a DCP. File -> Open is for loading DCP-o-matic projects, not DCPs. To import a DCP, create a new project with File -> New and then click the \"Add DCP...\" button.") @@ -761,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); } } @@ -803,11 +814,11 @@ private: /* Remove any existing DCP if the user agrees */ auto const dcp_dir = _film->dir (_film->dcp_name(), false); - if (boost::filesystem::exists(dcp_dir)) { + if (dcp::filesystem::exists(dcp_dir)) { if (!confirm_dialog (this, wxString::Format (_("Do you want to overwrite the existing DCP %s?"), std_to_wx(dcp_dir.string()).data()))) { return; } - boost::filesystem::remove_all (dcp_dir); + dcp::filesystem::remove_all(dcp_dir); } try { @@ -981,7 +992,7 @@ private: return; } - if (boost::filesystem::exists(dialog.path())) { + if (dcp::filesystem::exists(dialog.path())) { bool ok = confirm_dialog( this, wxString::Format(_("File %s already exists. Do you want to overwrite it?"), std_to_wx(dialog.path().string()).data()) @@ -1581,6 +1592,7 @@ public: App () : wxApp () { + dcpomatic_setup_path_encoding (); #ifdef DCPOMATIC_LINUX XInitThreads (); #endif @@ -1633,8 +1645,6 @@ private: make_foreground_application (); #endif - dcpomatic_setup_path_encoding (); - /* Enable i18n; this will create a Config object to look for a force-configured language. This Config object will be wrong, however, because dcpomatic_setup @@ -1676,7 +1686,7 @@ private: signal_manager = new wxSignalManager (this); Bind (wxEVT_IDLE, boost::bind (&App::idle, this, _1)); - if (!_film_to_load.empty() && boost::filesystem::is_directory(_film_to_load)) { + if (!_film_to_load.empty() && dcp::filesystem::is_directory(_film_to_load)) { try { _frame->load_film (_film_to_load); } catch (exception& e) {