Cleanup: fix more comments/guards (and add check script).
[libdcp.git] / src / search.cc
index dc0f92a0e102412898ab4e077069efe423e6561f..e7871dc669e1754f849d1d3403dfeb5972598c28 100644 (file)
@@ -35,6 +35,7 @@
 #include "dcp.h"
 #include "decrypted_kdm.h"
 #include "exceptions.h"
+#include "filesystem.h"
 #include "search.h"
 
 
@@ -59,6 +60,12 @@ dcp::find_and_resolve_cpls (vector<boost::filesystem::path> const& directories,
 
        vector<shared_ptr<dcp::DCP>> dcps;
        for (auto i: directories) {
+               if (!filesystem::exists(i)) {
+                       /* Don't make a DCP object or it will try to create the parent directories
+                        * of i if they do not exist (#2344).
+                        */
+                       continue;
+               }
                auto dcp = make_shared<dcp::DCP>(i);
                vector<dcp::VerificationNote> notes;
                dcp->read (&notes, true);
@@ -78,7 +85,7 @@ dcp::find_and_resolve_cpls (vector<boost::filesystem::path> const& directories,
        for (auto i: dcps) {
                for (auto j: dcps) {
                        if (i != j) {
-                               i->resolve_refs(j->assets());
+                               i->resolve_refs(j->assets(true));
                        }
                }
        }