summaryrefslogtreecommitdiff
path: root/src/common/fs
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/fs')
-rw-r--r--src/common/fs/fs.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/common/fs/fs.cpp b/src/common/fs/fs.cpp
index d492480d9..d3159e908 100644
--- a/src/common/fs/fs.cpp
+++ b/src/common/fs/fs.cpp
@@ -321,7 +321,8 @@ bool RemoveDirContentsRecursively(const fs::path& path) {
321 321
322 std::error_code ec; 322 std::error_code ec;
323 323
324 for (const auto& entry : fs::recursive_directory_iterator(path, ec)) { 324 // TODO (Morph): Replace this with recursive_directory_iterator once it's fixed in MSVC.
325 for (const auto& entry : fs::directory_iterator(path, ec)) {
325 if (ec) { 326 if (ec) {
326 LOG_ERROR(Common_Filesystem, 327 LOG_ERROR(Common_Filesystem,
327 "Failed to completely enumerate the directory at path={}, ec_message={}", 328 "Failed to completely enumerate the directory at path={}, ec_message={}",
@@ -337,6 +338,12 @@ bool RemoveDirContentsRecursively(const fs::path& path) {
337 PathToUTF8String(entry.path()), ec.message()); 338 PathToUTF8String(entry.path()), ec.message());
338 break; 339 break;
339 } 340 }
341
342 // TODO (Morph): Remove this when MSVC fixes recursive_directory_iterator.
343 // recursive_directory_iterator throws an exception despite passing in a std::error_code.
344 if (entry.status().type() == fs::file_type::directory) {
345 return RemoveDirContentsRecursively(entry.path());
346 }
340 } 347 }
341 348
342 if (ec) { 349 if (ec) {
@@ -475,7 +482,8 @@ void IterateDirEntriesRecursively(const std::filesystem::path& path,
475 482
476 std::error_code ec; 483 std::error_code ec;
477 484
478 for (const auto& entry : fs::recursive_directory_iterator(path, ec)) { 485 // TODO (Morph): Replace this with recursive_directory_iterator once it's fixed in MSVC.
486 for (const auto& entry : fs::directory_iterator(path, ec)) {
479 if (ec) { 487 if (ec) {
480 break; 488 break;
481 } 489 }
@@ -495,6 +503,12 @@ void IterateDirEntriesRecursively(const std::filesystem::path& path,
495 break; 503 break;
496 } 504 }
497 } 505 }
506
507 // TODO (Morph): Remove this when MSVC fixes recursive_directory_iterator.
508 // recursive_directory_iterator throws an exception despite passing in a std::error_code.
509 if (entry.status().type() == fs::file_type::directory) {
510 IterateDirEntriesRecursively(entry.path(), callback, filter);
511 }
498 } 512 }
499 513
500 if (callback_error || ec) { 514 if (callback_error || ec) {