- 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()));