diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-10-06 02:04:49 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-10-09 01:20:01 +0200 |
| commit | e4b2ebd80779a44d24fe87af26ef278c1e2d97d2 (patch) | |
| tree | 3bc940c5eb49c96c3c18a896c8ccd8039e6db839 /src/util.cc | |
| parent | 3be26a66645de04c7b220abeebfd2f024990a696 (diff) | |
Add wrappers around boost::filesystem methods that handle the
required mangling of long filenames on Windows.
Also wrap lots of missing places (e.g. calls to asdcplib, libxml++,
libcxml etc.) in dcp::filesystem::fix_long_path().
The idea is to keep paths un-mangled until they we call some
filesystem-related API and mangle them at that point. Otherwise
we end up serialising mangled names, which seems like it will
not end well.
Should fix DoM #2623.
Diffstat (limited to 'src/util.cc')
| -rw-r--r-- | src/util.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/util.cc b/src/util.cc index bbfcd30e..1ff36f59 100644 --- a/src/util.cc +++ b/src/util.cc @@ -42,6 +42,7 @@ #include "dcp_assert.h" #include "exceptions.h" #include "file.h" +#include "filesystem.h" #include "language_tag.h" #include "openjpeg_image.h" #include "rating.h" @@ -119,7 +120,7 @@ string dcp::make_digest (boost::filesystem::path filename, function<void (float)> progress) { Kumu::FileReader reader; - auto r = reader.OpenRead (filename.string().c_str ()); + auto r = reader.OpenRead(dcp::filesystem::fix_long_path(filename).string().c_str()); if (ASDCP_FAILURE(r)) { boost::throw_exception (FileError("could not open file to compute digest", filename, r)); } @@ -254,7 +255,7 @@ dcp::ids_equal (string a, string b) string dcp::file_to_string (boost::filesystem::path p, uintmax_t max_length) { - auto len = boost::filesystem::file_size (p); + auto len = filesystem::file_size(p); if (len > max_length) { throw MiscError (String::compose("Unexpectedly long file (%1)", p.string())); } @@ -421,7 +422,7 @@ ASDCPErrorSuspender::~ASDCPErrorSuspender () boost::filesystem::path dcp::directory_containing_executable () { #if BOOST_VERSION >= 106100 - return boost::filesystem::canonical(boost::dll::program_location().parent_path()); + return filesystem::canonical(boost::dll::program_location().parent_path()); #else char buffer[PATH_MAX]; ssize_t N = readlink ("/proc/self/exe", buffer, PATH_MAX); |
