diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-06-20 22:06:02 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-06-27 00:06:50 +0200 |
| commit | 96e1c1e817887ebf51d7f825306b26e8abe2f717 (patch) | |
| tree | 6efca55b349f4882643543cc964e2c44234e4fd8 /src | |
| parent | 0573dd642350e16ffdb82887cc3cdc4f1822f320 (diff) | |
Add Asset::set_file_preserving_hash().
Diffstat (limited to 'src')
| -rw-r--r-- | src/asset.cc | 7 | ||||
| -rw-r--r-- | src/asset.h | 9 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/asset.cc b/src/asset.cc index cd56c3ea..b69e68e8 100644 --- a/src/asset.cc +++ b/src/asset.cc @@ -163,6 +163,13 @@ Asset::set_file (path file) const void +Asset::set_file_preserving_hash(path file) const +{ + _file = absolute(file); +} + + +void Asset::rename_file(path file) { _file = absolute(file); diff --git a/src/asset.h b/src/asset.h index 923720ff..c5d50010 100644 --- a/src/asset.h +++ b/src/asset.h @@ -109,6 +109,15 @@ public: */ void set_file (boost::filesystem::path file) const; + /** Set the file that holds this asset on disk. Calling this function + * preserves the object's store of its hash, so if the object already + * has a hash it is up to the caller to ensure that the new file has + * the same hash. + * + * @param file New file's path. + */ + void set_file_preserving_hash(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. |
