summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-03-11 20:23:11 +0000
committerCarl Hetherington <cth@carlh.net>2020-03-11 21:24:28 +0100
commitbc36ddea65fda2088f7e8fa98390e3feac07df84 (patch)
treefb9b7f9ff44f256a2b740e5c5b97893ca5ece82e /src/tools
parent755694dd44cf5a012825b8b822da3738461b81ad (diff)
Give a better error when opening a DCP with File -> Open by mistake (#1723).
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/dcpomatic.cc19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc
index ea3cfbe32..aea058d80 100644
--- a/src/tools/dcpomatic.cc
+++ b/src/tools/dcpomatic.cc
@@ -447,10 +447,21 @@ public:
JobManager::instance()->add(shared_ptr<Job>(new CheckContentChangeJob(film)));
}
- catch (std::exception& e) {
- wxString p = std_to_wx (file.string ());
- wxCharBuffer b = p.ToUTF8 ();
- error_dialog (this, wxString::Format (_("Could not open film at %s"), p.data()), std_to_wx (e.what()));
+ catch (FileNotFoundError& e) {
+ boost::filesystem::path const dir = e.file().parent_path();
+ if (boost::filesystem::exists(dir / "ASSETMAP") || boost::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.")
+ );
+ } else {
+ wxString const p = std_to_wx(file.string ());
+ error_dialog (this, wxString::Format(_("Could not open film at %s"), p.data()), std_to_wx(e.what()));
+ }
+
+ } catch (std::exception& e) {
+ wxString const p = std_to_wx (file.string());
+ error_dialog (this, wxString::Format(_("Could not open film at %s"), p.data()), std_to_wx(e.what()));
}
void set_film (shared_ptr<Film> film)