Browse Source
Merge pull request #4785 from Morph1984/fs-hades
filesystem: Fix CreateDirectory and DeleteFile
pull/15/merge
bunnei
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
3 additions and
2 deletions
-
src/core/hle/service/filesystem/filesystem.cpp
|
|
|
@ -79,7 +79,7 @@ ResultCode VfsDirectoryServiceWrapper::DeleteFile(const std::string& path_) cons |
|
|
|
} |
|
|
|
|
|
|
|
auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path)); |
|
|
|
if (dir->GetFile(Common::FS::GetFilename(path)) == nullptr) { |
|
|
|
if (dir == nullptr || dir->GetFile(Common::FS::GetFilename(path)) == nullptr) { |
|
|
|
return FileSys::ERROR_PATH_NOT_FOUND; |
|
|
|
} |
|
|
|
if (!dir->DeleteFile(Common::FS::GetFilename(path))) { |
|
|
|
@ -93,8 +93,9 @@ ResultCode VfsDirectoryServiceWrapper::DeleteFile(const std::string& path_) cons |
|
|
|
ResultCode VfsDirectoryServiceWrapper::CreateDirectory(const std::string& path_) const { |
|
|
|
std::string path(Common::FS::SanitizePath(path_)); |
|
|
|
auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path)); |
|
|
|
if (dir == nullptr && Common::FS::GetFilename(Common::FS::GetParentPath(path)).empty()) |
|
|
|
if (dir == nullptr || Common::FS::GetFilename(Common::FS::GetParentPath(path)).empty()) { |
|
|
|
dir = backing; |
|
|
|
} |
|
|
|
auto new_dir = dir->CreateSubdirectory(Common::FS::GetFilename(path)); |
|
|
|
if (new_dir == nullptr) { |
|
|
|
// TODO(DarkLordZach): Find a better error code for this
|
|
|
|
|