Browse Source
Merge pull request #1228 from lioncash/construct
filesystem: Move dir retrieval after path checking in DeleteFile()
pull/15/merge
bunnei
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
5 additions and
2 deletions
-
src/core/hle/service/filesystem/filesystem.cpp
|
|
|
@ -60,17 +60,20 @@ ResultCode VfsDirectoryServiceWrapper::CreateFile(const std::string& path_, u64 |
|
|
|
|
|
|
|
ResultCode VfsDirectoryServiceWrapper::DeleteFile(const std::string& path_) const { |
|
|
|
std::string path(FileUtil::SanitizePath(path_)); |
|
|
|
auto dir = GetDirectoryRelativeWrapped(backing, FileUtil::GetParentPath(path)); |
|
|
|
if (path.empty()) { |
|
|
|
// TODO(DarkLordZach): Why do games call this and what should it do? Works as is but...
|
|
|
|
return RESULT_SUCCESS; |
|
|
|
} |
|
|
|
if (dir->GetFile(FileUtil::GetFilename(path)) == nullptr) |
|
|
|
|
|
|
|
auto dir = GetDirectoryRelativeWrapped(backing, FileUtil::GetParentPath(path)); |
|
|
|
if (dir->GetFile(FileUtil::GetFilename(path)) == nullptr) { |
|
|
|
return FileSys::ERROR_PATH_NOT_FOUND; |
|
|
|
} |
|
|
|
if (!dir->DeleteFile(FileUtil::GetFilename(path))) { |
|
|
|
// TODO(DarkLordZach): Find a better error code for this
|
|
|
|
return ResultCode(-1); |
|
|
|
} |
|
|
|
|
|
|
|
return RESULT_SUCCESS; |
|
|
|
} |
|
|
|
|
|
|
|
|