diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-10-06 02:37:16 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-10-09 23:38:28 +0200 |
| commit | 96f50dd5e600925488fdd9db1580aa01b026269b (patch) | |
| tree | ea8b837a596eb99a7416bfdbfd2d7e4f38603a7b /src/lib/content_factory.cc | |
| parent | 94a9473993b027b9368077009decbdd4322f90e3 (diff) | |
Use dcp::filesystem to wrap filesystem calls and fix_long_path
anything that is passed to read_file() from libcxml.
This should fix #2623 and other similar problems.
Diffstat (limited to 'src/lib/content_factory.cc')
| -rw-r--r-- | src/lib/content_factory.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/lib/content_factory.cc b/src/lib/content_factory.cc index b23a088b4..e1278c3b4 100644 --- a/src/lib/content_factory.cc +++ b/src/lib/content_factory.cc @@ -40,6 +40,7 @@ #include "log.h" #include "compose.hpp" #include <libcxml/cxml.h> +#include <dcp/filesystem.h> #include <dcp/smpte_subtitle_asset.h> #include <boost/algorithm/string.hpp> @@ -111,11 +112,11 @@ content_factory (boost::filesystem::path path) { vector<shared_ptr<Content>> content; - if (boost::filesystem::is_directory (path)) { + if (dcp::filesystem::is_directory(path)) { LOG_GENERAL ("Look in directory %1", path); - if (boost::filesystem::is_empty (path)) { + if (dcp::filesystem::is_empty(path)) { return content; } @@ -124,7 +125,7 @@ content_factory (boost::filesystem::path path) int image_files = 0; int sound_files = 0; int read = 0; - for (boost::filesystem::directory_iterator i(path); i != boost::filesystem::directory_iterator() && read < 10; ++i) { + for (dcp::filesystem::directory_iterator i(path); i != dcp::filesystem::directory_iterator() && read < 10; ++i) { LOG_GENERAL ("Checking file %1", i->path()); @@ -134,7 +135,7 @@ content_factory (boost::filesystem::path path) continue; } - if (!boost::filesystem::is_regular_file(i->path())) { + if (!dcp::filesystem::is_regular_file(i->path())) { /* Ignore things which aren't files (probably directories) */ LOG_GENERAL ("Ignored %1 (not a regular file)", i->path()); continue; @@ -154,7 +155,7 @@ content_factory (boost::filesystem::path path) if (image_files > 0 && sound_files == 0) { content.push_back (make_shared<ImageContent>(path)); } else if (image_files == 0 && sound_files > 0) { - for (auto i: boost::filesystem::directory_iterator(path)) { + for (auto i: dcp::filesystem::directory_iterator(path)) { content.push_back (make_shared<FFmpegContent>(i.path())); } } @@ -172,7 +173,7 @@ content_factory (boost::filesystem::path path) single = make_shared<StringTextFileContent>(path); } else if (ext == ".xml") { cxml::Document doc; - doc.read_file (path); + doc.read_file(dcp::filesystem::fix_long_path(path)); if (doc.root_name() == "DCinemaSecurityMessage") { throw KDMAsContentError (); } |
