summaryrefslogtreecommitdiff
path: root/src/buildtool/file_system/file_system_manager.hpp
diff options
context:
space:
mode:
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 {}",