From 53b444191fddd72416647ec9d24aff1e317a1824 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 6 Mar 2023 01:01:04 +0100 Subject: Add Asset::rename_file(). --- src/asset.cc | 7 +++++++ src/asset.h | 8 ++++++++ 2 files changed, 15 insertions(+) (limited to 'src') diff --git a/src/asset.cc b/src/asset.cc index c164a26b..cd56c3ea 100644 --- a/src/asset.cc +++ b/src/asset.cc @@ -162,6 +162,13 @@ Asset::set_file (path file) const } +void +Asset::rename_file(path file) +{ + _file = absolute(file); +} + + void Asset::set_hash (string hash) { diff --git a/src/asset.h b/src/asset.h index a6b0ed56..923720ff 100644 --- a/src/asset.h +++ b/src/asset.h @@ -109,6 +109,14 @@ public: */ void set_file (boost::filesystem::path file) const; + /** Set the file that holds this asset on disk. The new file must + * be exactly the same as the old one, as this function assumes + * that the object's hash does not change. + * + * @param file New file's path. + */ + void rename_file(boost::filesystem::path file); + /** Calculate the hash of this asset's file, if it has not already been calculated, * then return it * @param progress Function that will be called with a parameter between 0 and 1 to indicate -- cgit v1.2.3