Don't take any notice of ._* files when deciding whether a folder contains images...
authorCarl Hetherington <cth@carlh.net>
Mon, 28 Sep 2015 11:29:56 +0000 (12:29 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 28 Sep 2015 11:29:56 +0000 (12:29 +0100)
ChangeLog
src/lib/content_factory.cc

index 6671469dd0f60a12cee15f6a1274f89ac0e18dca..ac1eb70267f7d88abf0f3b8d6bc079bb677d4bb0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-09-28  c.hetherington  <cth@carlh.net>
+
+       * Fix mis-identification of a folder of images
+       as a DCP in some cases.
+
 2015-09-27  Carl Hetherington  <cth@carlh.net>
 
        * Version 2.3.7 released.
index 5b6d71641929023aa3fd06fe0f43f99e9ac29ae3..3aa8ca9d31eb16ef16dc34ce776f43b198a50ad8 100644 (file)
@@ -30,6 +30,7 @@
 #include "util.h"
 #include <libcxml/cxml.h>
 #include <dcp/smpte_subtitle_asset.h>
+#include <boost/algorithm/string.hpp>
 
 using std::string;
 using std::list;
@@ -88,10 +89,18 @@ content_factory (shared_ptr<const Film> film, boost::filesystem::path path)
 
                bool is_dcp = false;
                int read = 0;
-               for (boost::filesystem::directory_iterator i(path); i != boost::filesystem::directory_iterator() && read < 10; ++i, ++read) {
+               for (boost::filesystem::directory_iterator i(path); i != boost::filesystem::directory_iterator() && read < 10; ++i) {
+
+                       if (boost::starts_with (i->path().leaf().string(), "._")) {
+                               /* We ignore these files */
+                               continue;
+                       }
+
                        if (!boost::filesystem::is_regular_file (i->path()) || !valid_image_file (i->path())) {
                                is_dcp = true;
                        }
+
+                       ++read;
                }
 
                if (is_dcp) {