diff options
author | bunnei <bunneidev@gmail.com> | 2021-05-02 09:45:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-02 09:45:18 +0200 |
commit | 01a57d4c8d1000a827bca21d6a3ed2f57247d51e (patch) | |
tree | 48021bf1ca1a8f23250dc6c278f5049f53fd6a73 /src/core/hle | |
parent | Merge pull request #6245 from lat9nq/boost-only-config (diff) | |
parent | service: filesystem: Return proper error codes for CreateFile (diff) | |
download | yuzu-01a57d4c8d1000a827bca21d6a3ed2f57247d51e.tar yuzu-01a57d4c8d1000a827bca21d6a3ed2f57247d51e.tar.gz yuzu-01a57d4c8d1000a827bca21d6a3ed2f57247d51e.tar.bz2 yuzu-01a57d4c8d1000a827bca21d6a3ed2f57247d51e.tar.lz yuzu-01a57d4c8d1000a827bca21d6a3ed2f57247d51e.tar.xz yuzu-01a57d4c8d1000a827bca21d6a3ed2f57247d51e.tar.zst yuzu-01a57d4c8d1000a827bca21d6a3ed2f57247d51e.zip |
Diffstat (limited to 'src/core/hle')
-rw-r--r-- | src/core/hle/service/filesystem/filesystem.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp index 72ad273b2..67b2b3102 100644 --- a/src/core/hle/service/filesystem/filesystem.cpp +++ b/src/core/hle/service/filesystem/filesystem.cpp @@ -55,10 +55,15 @@ std::string VfsDirectoryServiceWrapper::GetName() const { ResultCode VfsDirectoryServiceWrapper::CreateFile(const std::string& path_, u64 size) const { std::string path(Common::FS::SanitizePath(path_)); auto dir = GetDirectoryRelativeWrapped(backing, Common::FS::GetParentPath(path)); - // dir can be nullptr if path contains subdirectories, create those prior to creating the file. if (dir == nullptr) { - dir = backing->CreateSubdirectory(Common::FS::GetParentPath(path)); + return FileSys::ERROR_PATH_NOT_FOUND; + } + + const auto entry_type = GetEntryType(path); + if (entry_type.Code() == RESULT_SUCCESS) { + return FileSys::ERROR_PATH_ALREADY_EXISTS; } + auto file = dir->CreateFile(Common::FS::GetFilename(path)); if (file == nullptr) { // TODO(DarkLordZach): Find a better error code for this |