diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-07-04 12:32:32 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-07-05 15:16:23 +0200 |
commit | abe2c89fc0e4f41f00aca3510e9bb4902e52c9e7 (patch) | |
tree | 82105fa2275f1d2f403215d6c268b8b419cebeb0 /src/other_tools/root_maps/distdir_git_map.cpp | |
parent | b1ce7ce328e322cafa2401af77a9334c61b72034 (diff) | |
download | justbuild-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.cpp | 28 |
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 |