diff options
| author | 2018-03-04 14:34:48 -0500 | |
|---|---|---|
| committer | 2018-03-04 14:34:48 -0500 | |
| commit | 84e1c0a43016e4c0e99aa50b1486af53b7d05513 (patch) | |
| tree | 27d2518fb50ce2a48204a3cb715b5a93f5c95ede /src/core/file_sys | |
| parent | FS: Stubbed CreateSaveData. It currently does nothing. (diff) | |
| download | yuzu-84e1c0a43016e4c0e99aa50b1486af53b7d05513.tar.gz yuzu-84e1c0a43016e4c0e99aa50b1486af53b7d05513.tar.xz yuzu-84e1c0a43016e4c0e99aa50b1486af53b7d05513.zip | |
FS: Use the correct error code when trying to open files that don't exist.
Diffstat (limited to 'src/core/file_sys')
| -rw-r--r-- | src/core/file_sys/disk_filesystem.cpp | 7 | ||||
| -rw-r--r-- | src/core/file_sys/errors.h | 25 |
2 files changed, 6 insertions, 26 deletions
diff --git a/src/core/file_sys/disk_filesystem.cpp b/src/core/file_sys/disk_filesystem.cpp index be7574fdb..22b17ba04 100644 --- a/src/core/file_sys/disk_filesystem.cpp +++ b/src/core/file_sys/disk_filesystem.cpp | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 8 | #include "common/logging/log.h" | 8 | #include "common/logging/log.h" |
| 9 | #include "core/file_sys/disk_filesystem.h" | 9 | #include "core/file_sys/disk_filesystem.h" |
| 10 | #include "core/file_sys/errors.h" | ||
| 10 | 11 | ||
| 11 | namespace FileSys { | 12 | namespace FileSys { |
| 12 | 13 | ||
| @@ -22,8 +23,7 @@ ResultVal<std::unique_ptr<StorageBackend>> Disk_FileSystem::OpenFile(const std:: | |||
| 22 | auto file = std::make_shared<FileUtil::IOFile>(full_path, mode == Mode::Read ? "rb" : "wb"); | 23 | auto file = std::make_shared<FileUtil::IOFile>(full_path, mode == Mode::Read ? "rb" : "wb"); |
| 23 | 24 | ||
| 24 | if (!file->IsOpen()) { | 25 | if (!file->IsOpen()) { |
| 25 | // TODO(Subv): Find out the correct error code. | 26 | return ERROR_PATH_NOT_FOUND; |
| 26 | return ResultCode(-1); | ||
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | return MakeResult<std::unique_ptr<StorageBackend>>( | 29 | return MakeResult<std::unique_ptr<StorageBackend>>( |
| @@ -100,8 +100,7 @@ u64 Disk_FileSystem::GetFreeSpaceSize() const { | |||
| 100 | ResultVal<FileSys::EntryType> Disk_FileSystem::GetEntryType(const std::string& path) const { | 100 | ResultVal<FileSys::EntryType> Disk_FileSystem::GetEntryType(const std::string& path) const { |
| 101 | std::string full_path = base_directory + path; | 101 | std::string full_path = base_directory + path; |
| 102 | if (!FileUtil::Exists(full_path)) { | 102 | if (!FileUtil::Exists(full_path)) { |
| 103 | // TODO(Subv): Find out what this actually means | 103 | return ERROR_PATH_NOT_FOUND; |
| 104 | return ResultCode(ErrorModule::FS, 1); | ||
| 105 | } | 104 | } |
| 106 | 105 | ||
| 107 | // TODO(Subv): Find out the EntryType values | 106 | // TODO(Subv): Find out the EntryType values |
diff --git a/src/core/file_sys/errors.h b/src/core/file_sys/errors.h index be3224ef8..0ed7d2a0c 100644 --- a/src/core/file_sys/errors.h +++ b/src/core/file_sys/errors.h | |||
| @@ -10,36 +10,17 @@ namespace FileSys { | |||
| 10 | 10 | ||
| 11 | namespace ErrCodes { | 11 | namespace ErrCodes { |
| 12 | enum { | 12 | enum { |
| 13 | RomFSNotFound = 100, | 13 | NotFound = 1, |
| 14 | ArchiveNotMounted = 101, | ||
| 15 | FileNotFound = 112, | ||
| 16 | PathNotFound = 113, | ||
| 17 | GameCardNotInserted = 141, | ||
| 18 | NotFound = 120, | ||
| 19 | FileAlreadyExists = 180, | ||
| 20 | DirectoryAlreadyExists = 185, | ||
| 21 | AlreadyExists = 190, | ||
| 22 | InvalidOpenFlags = 230, | ||
| 23 | DirectoryNotEmpty = 240, | ||
| 24 | NotAFile = 250, | ||
| 25 | NotFormatted = 340, ///< This is used by the FS service when creating a SaveData archive | ||
| 26 | ExeFSSectionNotFound = 567, | ||
| 27 | CommandNotAllowed = 630, | ||
| 28 | InvalidReadFlag = 700, | ||
| 29 | InvalidPath = 702, | ||
| 30 | WriteBeyondEnd = 705, | ||
| 31 | UnsupportedOpenFlags = 760, | ||
| 32 | IncorrectExeFSReadSize = 761, | ||
| 33 | UnexpectedFileOrDirectory = 770, | ||
| 34 | }; | 14 | }; |
| 35 | } | 15 | } |
| 36 | 16 | ||
| 17 | constexpr ResultCode ERROR_PATH_NOT_FOUND(ErrorModule::FS, ErrCodes::NotFound); | ||
| 18 | |||
| 37 | // TODO(bunnei): Replace these with correct errors for Switch OS | 19 | // TODO(bunnei): Replace these with correct errors for Switch OS |
| 38 | constexpr ResultCode ERROR_INVALID_PATH(ResultCode(-1)); | 20 | constexpr ResultCode ERROR_INVALID_PATH(ResultCode(-1)); |
| 39 | constexpr ResultCode ERROR_UNSUPPORTED_OPEN_FLAGS(ResultCode(-1)); | 21 | constexpr ResultCode ERROR_UNSUPPORTED_OPEN_FLAGS(ResultCode(-1)); |
| 40 | constexpr ResultCode ERROR_INVALID_OPEN_FLAGS(ResultCode(-1)); | 22 | constexpr ResultCode ERROR_INVALID_OPEN_FLAGS(ResultCode(-1)); |
| 41 | constexpr ResultCode ERROR_FILE_NOT_FOUND(ResultCode(-1)); | 23 | constexpr ResultCode ERROR_FILE_NOT_FOUND(ResultCode(-1)); |
| 42 | constexpr ResultCode ERROR_PATH_NOT_FOUND(ResultCode(-1)); | ||
| 43 | constexpr ResultCode ERROR_UNEXPECTED_FILE_OR_DIRECTORY(ResultCode(-1)); | 24 | constexpr ResultCode ERROR_UNEXPECTED_FILE_OR_DIRECTORY(ResultCode(-1)); |
| 44 | constexpr ResultCode ERROR_DIRECTORY_ALREADY_EXISTS(ResultCode(-1)); | 25 | constexpr ResultCode ERROR_DIRECTORY_ALREADY_EXISTS(ResultCode(-1)); |
| 45 | constexpr ResultCode ERROR_FILE_ALREADY_EXISTS(ResultCode(-1)); | 26 | constexpr ResultCode ERROR_FILE_ALREADY_EXISTS(ResultCode(-1)); |