diff options
| author | Lioncash <mathew1800@gmail.com> | 2018-11-30 14:44:13 -0500 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2018-11-30 20:17:28 -0500 |
| commit | a7d9fe993a3e0e4d939752d2e447cc2b5fdb80f0 (patch) | |
| tree | f5932b1a6b6451c41565b9b5a74dfff4f44fb6f0 /src/core/hle/service/filesystem/filesystem.cpp | |
| parent | b7104263baa0b404c25155c8d6b433149a2f9c86 (diff) | |
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/
Diffstat (limited to 'src/core/hle/service/filesystem/filesystem.cpp')
| -rw-r--r-- | src/core/hle/service/filesystem/filesystem.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp index 2aa77f68d..3bdff4036 100644 --- a/src/core/hle/service/filesystem/filesystem.cpp +++ b/src/core/hle/service/filesystem/filesystem.cpp @@ -113,6 +113,18 @@ ResultCode VfsDirectoryServiceWrapper::DeleteDirectoryRecursively(const std::str return RESULT_SUCCESS; } +ResultCode VfsDirectoryServiceWrapper::CleanDirectoryRecursively(const std::string& path) const { + const std::string sanitized_path(FileUtil::SanitizePath(path)); + auto dir = GetDirectoryRelativeWrapped(backing, FileUtil::GetParentPath(sanitized_path)); + + if (!dir->CleanSubdirectoryRecursive(FileUtil::GetFilename(sanitized_path))) { + // TODO(DarkLordZach): Find a better error code for this + return ResultCode(-1); + } + + return RESULT_SUCCESS; +} + ResultCode VfsDirectoryServiceWrapper::RenameFile(const std::string& src_path_, const std::string& dest_path_) const { std::string src_path(FileUtil::SanitizePath(src_path_)); |
