summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/buildtool/file_system/file_system_manager.hpp11
-rw-r--r--src/other_tools/root_maps/fpath_git_map.cpp4
-rw-r--r--test/buildtool/file_system/file_system_manager.test.cpp2
3 files changed, 8 insertions, 9 deletions
diff --git a/src/buildtool/file_system/file_system_manager.hpp b/src/buildtool/file_system/file_system_manager.hpp
index a6d15c84..528d50ca 100644
--- a/src/buildtool/file_system/file_system_manager.hpp
+++ b/src/buildtool/file_system/file_system_manager.hpp
@@ -408,10 +408,10 @@ class FileSystemManager {
return false;
}
+ /// \brief Copy directory recursively
[[nodiscard]] static auto CopyDirectoryImpl(
std::filesystem::path const& src,
- std::filesystem::path const& dst,
- bool recursively = false) noexcept -> bool {
+ std::filesystem::path const& dst) noexcept -> bool {
try {
// also checks existence
if (not IsDirectory(src)) {
@@ -428,11 +428,10 @@ class FileSystemManager {
dst.string());
return false;
}
- auto const opts =
+ static constexpr auto kOptions =
std::filesystem::copy_options::copy_symlinks |
- (recursively ? std::filesystem::copy_options::recursive
- : std::filesystem::copy_options::none);
- std::filesystem::copy(src, dst, opts);
+ std::filesystem::copy_options::recursive;
+ std::filesystem::copy(src, dst, kOptions);
return true;
} catch (std::exception const& e) {
Logger::Log(LogLevel::Error,
diff --git a/src/other_tools/root_maps/fpath_git_map.cpp b/src/other_tools/root_maps/fpath_git_map.cpp
index 4f9e3685..38a63bf9 100644
--- a/src/other_tools/root_maps/fpath_git_map.cpp
+++ b/src/other_tools/root_maps/fpath_git_map.cpp
@@ -412,8 +412,8 @@ auto CreateFilePathGitMap(
return;
}
// copy folder content to tmp dir
- if (not FileSystemManager::CopyDirectoryImpl(
- key.fpath, tmp_dir->GetPath(), /*recursively=*/true)) {
+ if (not FileSystemManager::CopyDirectoryImpl(key.fpath,
+ tmp_dir->GetPath())) {
(*logger)(
fmt::format("Failed to copy content from directory {}",
key.fpath.string()),
diff --git a/test/buildtool/file_system/file_system_manager.test.cpp b/test/buildtool/file_system/file_system_manager.test.cpp
index 86334faf..805d8bc1 100644
--- a/test/buildtool/file_system/file_system_manager.test.cpp
+++ b/test/buildtool/file_system/file_system_manager.test.cpp
@@ -743,7 +743,7 @@ TEST_CASE("CopyDirectoryImpl", "[file_system]") {
CHECK(FileSystemManager::WriteFile("boo", "a/bb.txt"));
// Test copy
- CHECK(FileSystemManager::CopyDirectoryImpl("a", to, true));
+ CHECK(FileSystemManager::CopyDirectoryImpl("a", to));
// Result should be in tmp-dir now
CHECK(FileSystemManager::IsDirectory(to));