using std::map;
using std::shared_ptr;
+using std::string;
using std::vector;
if (dcp::filesystem::is_regular_file(candidate.path())) {
for (auto& replacement: replacement_paths) {
for (auto& path: replacement.second) {
- if (!dcp::filesystem::exists(path) && path.filename() == candidate.path().filename()) {
+ /* Extract a filename as if this path were from a platform with a different
+ * separator.
+ */
+ string other = path.string();
+#ifdef DCPOMATIC_POSIX
+ std::replace(other.begin(), other.end(), '\\', '/');
+#else
+ std::replace(other.begin(), other.end(), '/', '\\');
+#endif
+ boost::filesystem::path other_path(other);
+ if (
+ !dcp::filesystem::exists(path) &&
+ (path.filename() == candidate.path().filename() || other_path.filename() == candidate.path().filename())) {
path = candidate.path();
}
}
}
+
+BOOST_AUTO_TEST_CASE(test_film_saved_on_windows)
+{
+ auto film = make_shared<Film>(boost::filesystem::path("test/data/windows_film"));
+ film->read_metadata();
+ dcpomatic::find_missing(film->content(), TestPaths::private_data());
+
+ for (auto content: film->content()) {
+ BOOST_CHECK(content->paths_valid());
+ }
+}
+
+
+BOOST_AUTO_TEST_CASE(test_film_saved_on_posix)
+{
+ auto film = make_shared<Film>(boost::filesystem::path("test/data/posix_film"));
+ film->read_metadata();
+ dcpomatic::find_missing(film->content(), TestPaths::private_data());
+
+ for (auto content: film->content()) {
+ BOOST_CHECK(content->paths_valid());
+ }
+}