From bc93b16bf6eccf23d7018444872867f97f5dc94d Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Tue, 23 May 2023 15:19:28 +0200 Subject: FileRoot: Add ignore-special roots logic --- src/buildtool/file_system/file_system_manager.hpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/buildtool/file_system/file_system_manager.hpp') 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 {}", -- cgit v1.2.3