mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-06-28 16:15:34 +02:00
[fs] use recursive_directory_iterator since MSVC CRT no longer should bug out
Signed-off-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
parent
d8a8169eb2
commit
51d9476e98
1 changed files with 2 additions and 8 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue