From fa96d9dc56f5185b45149d42929e3da885c6e6c8 Mon Sep 17 00:00:00 2001 From: lizzie Date: Wed, 4 Mar 2026 05:42:14 +0000 Subject: [PATCH] [fs] use recursive_directory_iterator since MSVC CRT no longer should bug out Signed-off-by: lizzie --- src/common/fs/fs.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/common/fs/fs.cpp b/src/common/fs/fs.cpp index cd2157490b..90cef15001 100644 --- a/src/common/fs/fs.cpp +++ b/src/common/fs/fs.cpp @@ -455,23 +455,17 @@ void IterateDirEntriesRecursively(const std::filesystem::path& path, const DirEn return; } - // TODO (Morph): Replace this with recursive_directory_iterator once it's fixed in MSVC. std::error_code ec; bool callback_error = false; - for (const auto& entry : fs::directory_iterator(path, ec)) { + // MSVC should now be fixed... right... right?!?!?! + for (const auto& entry : fs::recursive_directory_iterator(path, ec)) { if ((True(filter & DirEntryFilter::File) && entry.status().type() == fs::file_type::regular) || (True(filter & DirEntryFilter::Directory) && entry.status().type() == fs::file_type::directory)) { if (!callback(entry)) { callback_error = true; } } - // TODO (Morph): Remove this when MSVC fixes recursive_directory_iterator. - // recursive_directory_iterator throws an exception despite passing in a std::error_code. - if (entry.status().type() == fs::file_type::directory) { - IterateDirEntriesRecursively(entry.path(), callback, filter); - } } - if (callback_error || ec) { LOG_ERROR(Common_Filesystem, "Failed to visit all the directory entries of path={}, ec_message={}, callback_error={}", PathToUTF8String(path), ec.message(), callback_error); } else {