Don't crash immediately if there's no private data.
authorCarl Hetherington <cth@carlh.net>
Tue, 21 Mar 2023 11:24:20 +0000 (12:24 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 22 Mar 2023 22:37:51 +0000 (23:37 +0100)
test/test.cc

index 9d444e5cbb46bb9c974bd24243b824ceec630044..c91701e558ce1302c4fd32c60d54848c780f674d 100644 (file)
@@ -94,7 +94,13 @@ TestPaths::TestPaths::private_data ()
                return boost::filesystem::path(env);
        }
 
-       return boost::filesystem::canonical(boost::filesystem::path ("..") / boost::filesystem::path ("dcpomatic-test-private"));
+       auto relative = boost::filesystem::path ("..") / boost::filesystem::path ("dcpomatic-test-private");
+       if (!boost::filesystem::exists(relative)) {
+               std::cerr << "No private test data found! Tests may fail.\n";
+               return relative;
+       }
+
+       return boost::filesystem::canonical(relative);
 }