diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/file_sys/archive_sdmc.cpp | 11 | ||||
| -rw-r--r-- | src/core/file_sys/archive_sdmc.h | 1 | ||||
| -rw-r--r-- | src/core/file_sys/archive_sdmcwriteonly.cpp | 2 | ||||
| -rw-r--r-- | src/core/file_sys/disk_archive.cpp | 2 |
4 files changed, 14 insertions, 2 deletions
diff --git a/src/core/file_sys/archive_sdmc.cpp b/src/core/file_sys/archive_sdmc.cpp index c747ba82c..333dfb92e 100644 --- a/src/core/file_sys/archive_sdmc.cpp +++ b/src/core/file_sys/archive_sdmc.cpp | |||
| @@ -19,6 +19,17 @@ namespace FileSys { | |||
| 19 | 19 | ||
| 20 | ResultVal<std::unique_ptr<FileBackend>> SDMCArchive::OpenFile(const Path& path, | 20 | ResultVal<std::unique_ptr<FileBackend>> SDMCArchive::OpenFile(const Path& path, |
| 21 | const Mode& mode) const { | 21 | const Mode& mode) const { |
| 22 | Mode modified_mode; | ||
| 23 | modified_mode.hex = mode.hex; | ||
| 24 | |||
| 25 | // SDMC archive always opens a file with at least read permission | ||
| 26 | modified_mode.read_flag.Assign(1); | ||
| 27 | |||
| 28 | return OpenFileBase(path, modified_mode); | ||
| 29 | } | ||
| 30 | |||
| 31 | ResultVal<std::unique_ptr<FileBackend>> SDMCArchive::OpenFileBase(const Path& path, | ||
| 32 | const Mode& mode) const { | ||
| 22 | LOG_DEBUG(Service_FS, "called path=%s mode=%01X", path.DebugStr().c_str(), mode.hex); | 33 | LOG_DEBUG(Service_FS, "called path=%s mode=%01X", path.DebugStr().c_str(), mode.hex); |
| 23 | 34 | ||
| 24 | const PathParser path_parser(path); | 35 | const PathParser path_parser(path); |
diff --git a/src/core/file_sys/archive_sdmc.h b/src/core/file_sys/archive_sdmc.h index 4fa47ff35..9d99b110c 100644 --- a/src/core/file_sys/archive_sdmc.h +++ b/src/core/file_sys/archive_sdmc.h | |||
| @@ -36,6 +36,7 @@ public: | |||
| 36 | u64 GetFreeBytes() const override; | 36 | u64 GetFreeBytes() const override; |
| 37 | 37 | ||
| 38 | protected: | 38 | protected: |
| 39 | ResultVal<std::unique_ptr<FileBackend>> OpenFileBase(const Path& path, const Mode& mode) const; | ||
| 39 | std::string mount_point; | 40 | std::string mount_point; |
| 40 | }; | 41 | }; |
| 41 | 42 | ||
diff --git a/src/core/file_sys/archive_sdmcwriteonly.cpp b/src/core/file_sys/archive_sdmcwriteonly.cpp index 64ae49b86..2aafc9b1d 100644 --- a/src/core/file_sys/archive_sdmcwriteonly.cpp +++ b/src/core/file_sys/archive_sdmcwriteonly.cpp | |||
| @@ -21,7 +21,7 @@ ResultVal<std::unique_ptr<FileBackend>> SDMCWriteOnlyArchive::OpenFile(const Pat | |||
| 21 | LOG_ERROR(Service_FS, "Read flag is not supported"); | 21 | LOG_ERROR(Service_FS, "Read flag is not supported"); |
| 22 | return ERROR_INVALID_READ_FLAG; | 22 | return ERROR_INVALID_READ_FLAG; |
| 23 | } | 23 | } |
| 24 | return SDMCArchive::OpenFile(path, mode); | 24 | return SDMCArchive::OpenFileBase(path, mode); |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | ResultVal<std::unique_ptr<DirectoryBackend>> SDMCWriteOnlyArchive::OpenDirectory( | 27 | ResultVal<std::unique_ptr<DirectoryBackend>> SDMCWriteOnlyArchive::OpenDirectory( |
diff --git a/src/core/file_sys/disk_archive.cpp b/src/core/file_sys/disk_archive.cpp index 43d199434..0e51fd1a6 100644 --- a/src/core/file_sys/disk_archive.cpp +++ b/src/core/file_sys/disk_archive.cpp | |||
| @@ -163,7 +163,7 @@ u64 DiskArchive::GetFreeBytes() const { | |||
| 163 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 163 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 164 | 164 | ||
| 165 | ResultVal<size_t> DiskFile::Read(const u64 offset, const size_t length, u8* buffer) const { | 165 | ResultVal<size_t> DiskFile::Read(const u64 offset, const size_t length, u8* buffer) const { |
| 166 | if (!mode.read_flag && !mode.write_flag) | 166 | if (!mode.read_flag) |
| 167 | return ResultCode(ErrorDescription::FS_InvalidOpenFlags, ErrorModule::FS, | 167 | return ResultCode(ErrorDescription::FS_InvalidOpenFlags, ErrorModule::FS, |
| 168 | ErrorSummary::Canceled, ErrorLevel::Status); | 168 | ErrorSummary::Canceled, ErrorLevel::Status); |
| 169 | 169 | ||