summaryrefslogtreecommitdiffstats
path: root/src/core/file_sys/vfs.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-11-30 20:44:13 +0100
committerLioncash <mathew1800@gmail.com>2018-12-01 02:17:28 +0100
commita7d9fe993a3e0e4d939752d2e447cc2b5fdb80f0 (patch)
treef5932b1a6b6451c41565b9b5a74dfff4f44fb6f0 /src/core/file_sys/vfs.cpp
parentMerge pull request #1829 from lioncash/lang (diff)
downloadyuzu-a7d9fe993a3e0e4d939752d2e447cc2b5fdb80f0.tar
yuzu-a7d9fe993a3e0e4d939752d2e447cc2b5fdb80f0.tar.gz
yuzu-a7d9fe993a3e0e4d939752d2e447cc2b5fdb80f0.tar.bz2
yuzu-a7d9fe993a3e0e4d939752d2e447cc2b5fdb80f0.tar.lz
yuzu-a7d9fe993a3e0e4d939752d2e447cc2b5fdb80f0.tar.xz
yuzu-a7d9fe993a3e0e4d939752d2e447cc2b5fdb80f0.tar.zst
yuzu-a7d9fe993a3e0e4d939752d2e447cc2b5fdb80f0.zip
Diffstat (limited to '')
-rw-r--r--src/core/file_sys/vfs.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/core/file_sys/vfs.cpp b/src/core/file_sys/vfs.cpp
index 7b584de7f..a4a3236f4 100644
--- a/src/core/file_sys/vfs.cpp
+++ b/src/core/file_sys/vfs.cpp
@@ -384,6 +384,28 @@ bool VfsDirectory::DeleteSubdirectoryRecursive(std::string_view name) {
return success;
}
+bool VfsDirectory::CleanSubdirectoryRecursive(std::string_view name) {
+ auto dir = GetSubdirectory(name);
+ if (dir == nullptr) {
+ return false;
+ }
+
+ bool success = true;
+ for (const auto& file : dir->GetFiles()) {
+ if (!dir->DeleteFile(file->GetName())) {
+ success = false;
+ }
+ }
+
+ for (const auto& sdir : dir->GetSubdirectories()) {
+ if (!dir->DeleteSubdirectoryRecursive(sdir->GetName())) {
+ success = false;
+ }
+ }
+
+ return success;
+}
+
bool VfsDirectory::Copy(std::string_view src, std::string_view dest) {
const auto f1 = GetFile(src);
auto f2 = CreateFile(dest);
@@ -435,6 +457,10 @@ bool ReadOnlyVfsDirectory::DeleteSubdirectory(std::string_view name) {
return false;
}
+bool ReadOnlyVfsDirectory::CleanSubdirectoryRecursive(std::string_view name) {
+ return false;
+}
+
bool ReadOnlyVfsDirectory::DeleteFile(std::string_view name) {
return false;
}