summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-10-05 00:51:09 +0200
committerCarl Hetherington <cth@carlh.net>2022-10-05 00:51:09 +0200
commitafa092638250c72a92136b0b440bb6bb7c070702 (patch)
treebbcfbb05b7e3f53ca70aece49474a94343c58ccd
parent6f23f3ff80fbd73cdaf183ce8bbdeeea0007ad6b (diff)
Add contains_assetmap()
-rw-r--r--src/lib/util.cc8
-rw-r--r--src/lib/util.h1
-rw-r--r--src/wx/content_view.cc3
3 files changed, 11 insertions, 1 deletions
diff --git a/src/lib/util.cc b/src/lib/util.cc
index cfeacdb92..609e92850 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -1187,3 +1187,11 @@ error_details(boost::system::error_code ec)
{
return String::compose("%1:%2:%3", ec.category().name(), ec.value(), ec.message());
}
+
+
+bool
+contains_assetmap(boost::filesystem::path dir)
+{
+ return boost::filesystem::is_regular_file(dir / "ASSETMAP") || boost::filesystem::is_regular_file(dir / "ASSETMAP.xml");
+}
+
diff --git a/src/lib/util.h b/src/lib/util.h
index c62b98df6..acdc861ae 100644
--- a/src/lib/util.h
+++ b/src/lib/util.h
@@ -127,6 +127,7 @@ extern std::string to_upper (std::string s);
extern void start_of_thread (std::string name);
extern void capture_asdcp_logs ();
extern std::string error_details(boost::system::error_code ec);
+extern bool contains_assetmap(boost::filesystem::path dir);
template <class T>
std::list<T>
diff --git a/src/wx/content_view.cc b/src/wx/content_view.cc
index 468b3bf97..73cc9e68b 100644
--- a/src/wx/content_view.cc
+++ b/src/wx/content_view.cc
@@ -28,6 +28,7 @@
#include "lib/dcpomatic_assert.h"
#include "lib/examine_content_job.h"
#include "lib/job_manager.h"
+#include "lib/util.h"
#include <dcp/exceptions.h>
#include <dcp/warnings.h>
#include <boost/filesystem.hpp>
@@ -94,7 +95,7 @@ ContentView::update ()
progress.Pulse ();
shared_ptr<Content> content;
- if (is_directory(i) && (is_regular_file(i / "ASSETMAP") || is_regular_file(i / "ASSETMAP.xml"))) {
+ if (is_directory(i) && contains_assetmap(i)) {
content = make_shared<DCPContent>(i);
} else if (i.path().extension() == ".mp4") {
auto all_content = content_factory(i);