summaryrefslogtreecommitdiff
path: root/src/asset.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-10-06 02:04:49 +0200
committerCarl Hetherington <cth@carlh.net>2023-10-09 01:20:01 +0200
commite4b2ebd80779a44d24fe87af26ef278c1e2d97d2 (patch)
tree3bc940c5eb49c96c3c18a896c8ccd8039e6db839 /src/asset.cc
parent3be26a66645de04c7b220abeebfd2f024990a696 (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/asset.cc')
-rw-r--r--src/asset.cc32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/asset.cc b/src/asset.cc
index 213d4878..15f81015 100644
--- a/src/asset.cc
+++ b/src/asset.cc
@@ -43,6 +43,7 @@
#include "dcp_assert.h"
#include "equality_options.h"
#include "exceptions.h"
+#include "filesystem.h"
#include "pkl.h"
#include "raw_convert.h"
#include "util.h"
@@ -57,7 +58,6 @@ using std::string;
using boost::function;
using std::shared_ptr;
using boost::optional;
-using namespace boost::filesystem;
using namespace dcp;
@@ -67,14 +67,14 @@ Asset::Asset ()
}
-Asset::Asset (path file)
+Asset::Asset(boost::filesystem::path file)
: _file (file)
{
}
-Asset::Asset (string id, path file)
+Asset::Asset(string id, boost::filesystem::path file)
: Object (id)
, _file (file)
{
@@ -83,13 +83,13 @@ Asset::Asset (string id, path file)
void
-Asset::add_to_pkl (shared_ptr<PKL> pkl, path root) const
+Asset::add_to_pkl(shared_ptr<PKL> pkl, boost::filesystem::path root) const
{
DCP_ASSERT (_file);
auto path = relative_to_root (
- canonical(root),
- canonical(_file.get())
+ filesystem::canonical(root),
+ filesystem::canonical(_file.get())
);
if (!path) {
@@ -104,7 +104,7 @@ Asset::add_to_pkl (shared_ptr<PKL> pkl, path root) const
void
-Asset::add_to_assetmap (AssetMap& asset_map, path root) const
+Asset::add_to_assetmap(AssetMap& asset_map, boost::filesystem::path root) const
{
DCP_ASSERT (_file);
add_file_to_assetmap (asset_map, root, _file.get(), _id);
@@ -112,11 +112,11 @@ Asset::add_to_assetmap (AssetMap& asset_map, path root) const
void
-Asset::add_file_to_assetmap (AssetMap& asset_map, path root, path file, string id)
+Asset::add_file_to_assetmap(AssetMap& asset_map, boost::filesystem::path root, boost::filesystem::path file, string id)
{
auto path = relative_to_root (
- canonical(root),
- canonical(file)
+ filesystem::canonical(root),
+ filesystem::canonical(file)
);
if (!path) {
@@ -160,24 +160,24 @@ Asset::equals(std::shared_ptr<const Asset> other, EqualityOptions const& opt, No
void
-Asset::set_file (path file) const
+Asset::set_file(boost::filesystem::path file) const
{
- _file = absolute (file);
+ _file = filesystem::absolute(file);
_hash = optional<string>();
}
void
-Asset::set_file_preserving_hash(path file) const
+Asset::set_file_preserving_hash(boost::filesystem::path file) const
{
- _file = absolute(file);
+ _file = filesystem::absolute(file);
}
void
-Asset::rename_file(path file)
+Asset::rename_file(boost::filesystem::path file)
{
- _file = absolute(file);
+ _file = filesystem::absolute(file);
}