summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2021-06-14 15:47:04 +0200
committerGitHub <noreply@github.com>2021-06-14 15:47:04 +0200
commit8d4dfc98ec50f4c769d37d84c5746f2243ef28b5 (patch)
tree1a072ca20116f968debd51ef7f7f6bbb4c01ea55
parentMerge pull request #6463 from Morph1984/restructure-logging (diff)
parentcommon: fs: Use the normal directory iterator in *Recursively functions (diff)
downloadyuzu-8d4dfc98ec50f4c769d37d84c5746f2243ef28b5.tar
yuzu-8d4dfc98ec50f4c769d37d84c5746f2243ef28b5.tar.gz
yuzu-8d4dfc98ec50f4c769d37d84c5746f2243ef28b5.tar.bz2
yuzu-8d4dfc98ec50f4c769d37d84c5746f2243ef28b5.tar.lz
yuzu-8d4dfc98ec50f4c769d37d84c5746f2243ef28b5.tar.xz
yuzu-8d4dfc98ec50f4c769d37d84c5746f2243ef28b5.tar.zst
yuzu-8d4dfc98ec50f4c769d37d84c5746f2243ef28b5.zip
-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) {
std::error_code ec;
- for (const auto& entry : fs::recursive_directory_iterator(path, ec)) {
+ // TODO (Morph): Replace this with recursive_directory_iterator once it's fixed in MSVC.
+ for (const auto& entry : fs::directory_iterator(path, ec)) {
if (ec) {
LOG_ERROR(Common_Filesystem,
"Failed to completely enumerate the directory at path={}, ec_message={}",
@@ -337,6 +338,12 @@ bool RemoveDirContentsRecursively(const fs::path& path) {
PathToUTF8String(entry.path()), ec.message());
break;
}
+
+ // 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) {
+ return RemoveDirContentsRecursively(entry.path());
+ }
}
if (ec) {
@@ -475,7 +482,8 @@ void IterateDirEntriesRecursively(const std::filesystem::path& path,
std::error_code ec;
- for (const auto& entry : fs::recursive_directory_iterator(path, ec)) {
+ // TODO (Morph): Replace this with recursive_directory_iterator once it's fixed in MSVC.
+ for (const auto& entry : fs::directory_iterator(path, ec)) {
if (ec) {
break;
}
@@ -495,6 +503,12 @@ void IterateDirEntriesRecursively(const std::filesystem::path& path,
break;
}
}
+
+ // 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) {