summaryrefslogtreecommitdiff
path: root/src/buildtool/file_system/file_system_manager.hpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-05-23 15:19:28 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-05-31 15:21:02 +0200
commitbc93b16bf6eccf23d7018444872867f97f5dc94d (patch)
tree412c03a39f98eec84d98ab10f0af3ab586d6c7e6 /src/buildtool/file_system/file_system_manager.hpp
parentda9c8f50b1a841830f3323f0438de2f3a0974022 (diff)
downloadjustbuild-bc93b16bf6eccf23d7018444872867f97f5dc94d.tar.gz
FileRoot: Add ignore-special roots logic
Diffstat (limited to 'src/buildtool/file_system/file_system_manager.hpp')
-rw-r--r--src/buildtool/file_system/file_system_manager.hpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/buildtool/file_system/file_system_manager.hpp b/src/buildtool/file_system/file_system_manager.hpp
index c7a31b29..ec2ab398 100644
--- a/src/buildtool/file_system/file_system_manager.hpp
+++ b/src/buildtool/file_system/file_system_manager.hpp
@@ -514,9 +514,13 @@ class FileSystemManager {
}
}
+ /// \brief Read a filesystem directory tree.
+ /// \param ignore_special If true, do not error out when encountering
+ /// symlinks.
[[nodiscard]] static auto ReadDirectory(
std::filesystem::path const& dir,
- ReadDirEntryFunc const& read_entry) noexcept -> bool {
+ ReadDirEntryFunc const& read_entry,
+ bool ignore_special = false) noexcept -> bool {
try {
for (auto const& entry : std::filesystem::directory_iterator{dir}) {
ObjectType type{};
@@ -532,6 +536,9 @@ class FileSystemManager {
else if (std::filesystem::is_directory(status)) {
type = ObjectType::Tree;
}
+ else if (ignore_special) {
+ continue;
+ }
else {
Logger::Log(LogLevel::Error,
"unsupported type for dir entry {}",