diff options
| author | 2018-09-02 09:17:45 -0400 | |
|---|---|---|
| committer | 2018-09-02 09:20:17 -0400 | |
| commit | fda8f1da2039dfddcf8471938a14114c674b82bb (patch) | |
| tree | affda23e8735d1cd56f09a151c7c93d1d2f824a9 /src | |
| parent | Merge pull request #1196 from FearlessTobi/ccache-consistency (diff) | |
| download | yuzu-fda8f1da2039dfddcf8471938a14114c674b82bb.tar.gz yuzu-fda8f1da2039dfddcf8471938a14114c674b82bb.tar.xz yuzu-fda8f1da2039dfddcf8471938a14114c674b82bb.zip | |
filesystem: Move dir retrieval after path checking in DeleteFile()
We don't need to do the lookup if the path is considered empty
currently.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/filesystem/filesystem.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp index 881c39e31..a4426af96 100644 --- a/src/core/hle/service/filesystem/filesystem.cpp +++ b/src/core/hle/service/filesystem/filesystem.cpp | |||
| @@ -60,17 +60,20 @@ ResultCode VfsDirectoryServiceWrapper::CreateFile(const std::string& path_, u64 | |||
| 60 | 60 | ||
| 61 | ResultCode VfsDirectoryServiceWrapper::DeleteFile(const std::string& path_) const { | 61 | ResultCode VfsDirectoryServiceWrapper::DeleteFile(const std::string& path_) const { |
| 62 | std::string path(FileUtil::SanitizePath(path_)); | 62 | std::string path(FileUtil::SanitizePath(path_)); |
| 63 | auto dir = GetDirectoryRelativeWrapped(backing, FileUtil::GetParentPath(path)); | ||
| 64 | if (path.empty()) { | 63 | if (path.empty()) { |
| 65 | // TODO(DarkLordZach): Why do games call this and what should it do? Works as is but... | 64 | // TODO(DarkLordZach): Why do games call this and what should it do? Works as is but... |
| 66 | return RESULT_SUCCESS; | 65 | return RESULT_SUCCESS; |
| 67 | } | 66 | } |
| 68 | if (dir->GetFile(FileUtil::GetFilename(path)) == nullptr) | 67 | |
| 68 | auto dir = GetDirectoryRelativeWrapped(backing, FileUtil::GetParentPath(path)); | ||
| 69 | if (dir->GetFile(FileUtil::GetFilename(path)) == nullptr) { | ||
| 69 | return FileSys::ERROR_PATH_NOT_FOUND; | 70 | return FileSys::ERROR_PATH_NOT_FOUND; |
| 71 | } | ||
| 70 | if (!dir->DeleteFile(FileUtil::GetFilename(path))) { | 72 | if (!dir->DeleteFile(FileUtil::GetFilename(path))) { |
| 71 | // TODO(DarkLordZach): Find a better error code for this | 73 | // TODO(DarkLordZach): Find a better error code for this |
| 72 | return ResultCode(-1); | 74 | return ResultCode(-1); |
| 73 | } | 75 | } |
| 76 | |||
| 74 | return RESULT_SUCCESS; | 77 | return RESULT_SUCCESS; |
| 75 | } | 78 | } |
| 76 | 79 | ||