mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2025-06-13 22:57:57 -05:00
service/fsp_srv: Implement CleanDirectoryRecursively
This is the same behavior-wise as DeleteDirectoryRecursively, with the only difference being that it doesn't delete the top level directory in the hierarchy, so given: root_dir/ - some_dir/ - File.txt - OtherFile.txt The end result is just: root_dir/
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user