summaryrefslogtreecommitdiff
path: root/src/other_tools/root_maps/distdir_git_map.cpp
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2024-07-04 12:32:32 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2024-07-05 15:16:23 +0200
commitabe2c89fc0e4f41f00aca3510e9bb4902e52c9e7 (patch)
tree82105fa2275f1d2f403215d6c268b8b419cebeb0 /src/other_tools/root_maps/distdir_git_map.cpp
parentb1ce7ce328e322cafa2401af77a9334c61b72034 (diff)
downloadjustbuild-abe2c89fc0e4f41f00aca3510e9bb4902e52c9e7.tar.gz
FileSystemManager::CreateFileHardlink: return error code on failure
Instead of returning a plain boolean, return an expected with the same boolean value that in case of an error indicates the error code. In this way, an error-specific handling is possible by consumers. While there, also add proper quoting of the involved file names.
Diffstat (limited to 'src/other_tools/root_maps/distdir_git_map.cpp')
-rw-r--r--src/other_tools/root_maps/distdir_git_map.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/other_tools/root_maps/distdir_git_map.cpp b/src/other_tools/root_maps/distdir_git_map.cpp
index 54abaae2..9171daae 100644
--- a/src/other_tools/root_maps/distdir_git_map.cpp
+++ b/src/other_tools/root_maps/distdir_git_map.cpp
@@ -42,19 +42,21 @@ namespace {
content_list,
std::filesystem::path const& tmp_dir) noexcept -> bool {
auto const& cas = storage.CAS();
- return std::all_of(content_list->begin(),
- content_list->end(),
- [&cas, tmp_dir](auto const& kv) {
- auto content_path =
- cas.BlobPath(ArtifactDigest(kv.second, 0, false),
- /*is_executable=*/false);
- if (content_path) {
- return FileSystemManager::CreateFileHardlink(
- *content_path, // from: cas_path/content_id
- tmp_dir / kv.first); // to: tmp_dir/name
- }
- return false;
- });
+ return std::all_of(
+ content_list->begin(),
+ content_list->end(),
+ [&cas, tmp_dir](auto const& kv) {
+ auto content_path =
+ cas.BlobPath(ArtifactDigest(kv.second, 0, false),
+ /*is_executable=*/false);
+ if (content_path) {
+ return FileSystemManager::CreateFileHardlink(
+ *content_path, // from: cas_path/content_id
+ tmp_dir / kv.first) // to: tmp_dir/name
+ .has_value();
+ }
+ return false;
+ });
}
/// \brief Called once we know we have the content blobs in local CAS in order