diff options
| author | bunnei <bunneidev@gmail.com> | 2018-12-03 17:04:05 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-12-03 17:04:05 -0500 |
| commit | f7d5f7294425f59bb9d7c417fa04efcbd49ced91 (patch) | |
| tree | fd398c37a6a276a56ab4265bfaa59904f3762e34 /src/core/hle/service/filesystem/filesystem.cpp | |
| parent | 118f4023824cd53512a9c7eb65f9f21bbcfcdc67 (diff) | |
| parent | 0ccaaafca30c245330a62bd39519fb05720a0bf2 (diff) | |
Merge pull request #1833 from lioncash/clean
service/fsp_srv: Implement CleanDirectoryRecursively
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_)); |
