diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-10-16 14:50:41 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-10-16 14:50:41 +0100 |
| commit | 2d2f00633ed41a00e5d8f6a4b42d4646b647e541 (patch) | |
| tree | d2189035b0aedde07b24a96249dfa72cef3486f1 /src/tools | |
| parent | 44b78ba0e1bd215fb307a0d5f557c0d4c48f0981 (diff) | |
Better error when trying to load a DCP from a non-DCP directory in the player.
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/dcpomatic_player.cc | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc index c2d053430..237b769bb 100644 --- a/src/tools/dcpomatic_player.cc +++ b/src/tools/dcpomatic_player.cc @@ -52,6 +52,7 @@ #include "lib/monitor_checker.h" #include <dcp/dcp.h> #include <dcp/raw_convert.h> +#include <dcp/exceptions.h> #include <wx/wx.h> #include <wx/stdpaths.h> #include <wx/splash.h> @@ -361,14 +362,18 @@ public: void load_dcp (boost::filesystem::path dir) { - dcp::DCP dcp (dir); - dcp.read (); - SPL spl; - BOOST_FOREACH (shared_ptr<dcp::CPL> j, dcp.cpls()) { - spl.playlist.push_back (SPLEntry(j, dir)); + try { + dcp::DCP dcp (dir); + dcp.read (); + SPL spl; + BOOST_FOREACH (shared_ptr<dcp::CPL> j, dcp.cpls()) { + spl.playlist.push_back (SPLEntry(j, dir)); + } + set_spl (spl); + Config::instance()->add_to_player_history (dir); + } catch (dcp::DCPReadError& e) { + error_dialog (this, wxString::Format(_("Could not load a DCP from %s"), std_to_wx(dir.string())), std_to_wx(e.what())); } - set_spl (spl); - Config::instance()->add_to_player_history (dir); } #ifdef DCPOMATIC_VARIANT_SWAROOP |
