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/sound_asset.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/sound_asset.cc')
| -rw-r--r-- | src/sound_asset.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/sound_asset.cc b/src/sound_asset.cc index c31f8bf4..0ceba53d 100644 --- a/src/sound_asset.cc +++ b/src/sound_asset.cc @@ -41,6 +41,7 @@ #include "dcp_assert.h" #include "equality_options.h" #include "exceptions.h" +#include "filesystem.h" #include "sound_asset.h" #include "sound_asset_reader.h" #include "sound_asset_writer.h" @@ -70,7 +71,7 @@ SoundAsset::SoundAsset (boost::filesystem::path file) : Asset (file) { ASDCP::PCM::MXFReader reader; - auto r = reader.OpenRead (file.string().c_str()); + auto r = reader.OpenRead(dcp::filesystem::fix_long_path(file).string().c_str()); if (ASDCP_FAILURE(r)) { boost::throw_exception (MXFFileError("could not open MXF file for reading", file.string(), r)); } @@ -139,13 +140,13 @@ SoundAsset::equals(shared_ptr<const Asset> other, EqualityOptions const& opt, No ASDCP::PCM::MXFReader reader_A; DCP_ASSERT (file()); - auto r = reader_A.OpenRead (file()->string().c_str()); + auto r = reader_A.OpenRead(dcp::filesystem::fix_long_path(*file()).string().c_str()); if (ASDCP_FAILURE(r)) { boost::throw_exception (MXFFileError("could not open MXF file for reading", file()->string(), r)); } ASDCP::PCM::MXFReader reader_B; - r = reader_B.OpenRead (other->file()->string().c_str()); + r = reader_B.OpenRead(dcp::filesystem::fix_long_path(*other->file()).string().c_str()); if (ASDCP_FAILURE (r)) { boost::throw_exception (MXFFileError("could not open MXF file for reading", other->file()->string(), r)); } @@ -278,7 +279,7 @@ bool SoundAsset::valid_mxf (boost::filesystem::path file) { ASDCP::PCM::MXFReader reader; - Kumu::Result_t r = reader.OpenRead (file.string().c_str()); + Kumu::Result_t r = reader.OpenRead(dcp::filesystem::fix_long_path(file).string().c_str()); return !ASDCP_FAILURE (r); } |
