Add contains_assetmap()
authorCarl Hetherington <cth@carlh.net>
Tue, 4 Oct 2022 22:51:09 +0000 (00:51 +0200)
committerCarl Hetherington <cth@carlh.net>
Tue, 4 Oct 2022 22:51:09 +0000 (00:51 +0200)
src/lib/util.cc
src/lib/util.h
src/wx/content_view.cc

index cfeacdb92cece74e3c0049081bba2964ace11fdb..609e9285003c57ad9923adcdfa3e9f69632b4604 100644 (file)
@@ -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");
+}
+
index c62b98df65c140cfcedc90d13cbfca36e45dd181..acdc861ae1cc0cd125c1fecf2236f2a2202986be 100644 (file)
@@ -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>
index 468b3bf97c0e4b324984d9c295c1939858f75a2d..73cc9e68bcee4dde0d88698a4192ff97d4cdfc92 100644 (file)
@@ -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);