summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-07-07 12:11:42 +0200
committerCarl Hetherington <cth@carlh.net>2025-07-07 12:11:42 +0200
commit6cfa18600fe575a4f9773ce5711b49ffc6003d04 (patch)
tree3c4658ab16eb4b899af2d0ae409c5e7e987fb02c
parent4fb11b7f92a104ed53792ca06b7b40a52e3858f6 (diff)
Load a DCP containing a file passed to the player (#3057).
-rw-r--r--src/tools/dcpomatic_player.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc
index 8721a1982..9fb4a049b 100644
--- a/src/tools/dcpomatic_player.cc
+++ b/src/tools/dcpomatic_player.cc
@@ -1403,7 +1403,17 @@ private:
bool OnCmdLineParsed (wxCmdLineParser& parser) override
{
if (parser.GetParamCount() > 0) {
- _dcp_to_load = wx_to_std (parser.GetParam (0));
+ auto path = boost::filesystem::path(wx_to_std(parser.GetParam(0)));
+ /* Go at most two directories higher looking for a DCP that contains the file
+ * that was passed in.
+ */
+ for (int i = 0; i < 2; ++i) {
+ if (dcp::filesystem::is_directory(path) && contains_assetmap(path)) {
+ _dcp_to_load = path;
+ break;
+ }
+ path = path.parent_path();
+ }
}
wxString config;