diff options
| author | 2018-01-19 22:08:21 -0500 | |
|---|---|---|
| committer | 2018-01-21 15:39:20 -0500 | |
| commit | 7988f0248959b2284ce5cc74bac6aef897627a8e (patch) | |
| tree | 387359a2a624e6616a3545c11ffbb100fe387900 /src/core/file_sys | |
| parent | file_sys: Repurpose 3DS IVFC code for Switch ROMFS. (diff) | |
| download | yuzu-7988f0248959b2284ce5cc74bac6aef897627a8e.tar.gz yuzu-7988f0248959b2284ce5cc74bac6aef897627a8e.tar.xz yuzu-7988f0248959b2284ce5cc74bac6aef897627a8e.zip | |
archive_backend: Minor changes to match Switch IFileSystem.
Diffstat (limited to 'src/core/file_sys')
| -rw-r--r-- | src/core/file_sys/archive_backend.h | 44 | ||||
| -rw-r--r-- | src/core/file_sys/romfs_archive.cpp | 2 | ||||
| -rw-r--r-- | src/core/file_sys/romfs_archive.h | 2 | ||||
| -rw-r--r-- | src/core/file_sys/savedata_archive.cpp | 2 | ||||
| -rw-r--r-- | src/core/file_sys/savedata_archive.h | 2 |
5 files changed, 26 insertions, 26 deletions
diff --git a/src/core/file_sys/archive_backend.h b/src/core/file_sys/archive_backend.h index 58f6c150c..2255bee42 100644 --- a/src/core/file_sys/archive_backend.h +++ b/src/core/file_sys/archive_backend.h | |||
| @@ -81,13 +81,12 @@ public: | |||
| 81 | virtual std::string GetName() const = 0; | 81 | virtual std::string GetName() const = 0; |
| 82 | 82 | ||
| 83 | /** | 83 | /** |
| 84 | * Open a file specified by its path, using the specified mode | 84 | * Create a file specified by its path |
| 85 | * @param path Path relative to the archive | 85 | * @param path Path relative to the Archive |
| 86 | * @param mode Mode to open the file with | 86 | * @param size The size of the new file, filled with zeroes |
| 87 | * @return Opened file, or error code | 87 | * @return Result of the operation |
| 88 | */ | 88 | */ |
| 89 | virtual ResultVal<std::unique_ptr<FileBackend>> OpenFile(const Path& path, | 89 | virtual ResultCode CreateFile(const Path& path, u64 size) const = 0; |
| 90 | const Mode& mode) const = 0; | ||
| 91 | 90 | ||
| 92 | /** | 91 | /** |
| 93 | * Delete a file specified by its path | 92 | * Delete a file specified by its path |
| @@ -97,12 +96,11 @@ public: | |||
| 97 | virtual ResultCode DeleteFile(const Path& path) const = 0; | 96 | virtual ResultCode DeleteFile(const Path& path) const = 0; |
| 98 | 97 | ||
| 99 | /** | 98 | /** |
| 100 | * Rename a File specified by its path | 99 | * Create a directory specified by its path |
| 101 | * @param src_path Source path relative to the archive | 100 | * @param path Path relative to the archive |
| 102 | * @param dest_path Destination path relative to the archive | ||
| 103 | * @return Result of the operation | 101 | * @return Result of the operation |
| 104 | */ | 102 | */ |
| 105 | virtual ResultCode RenameFile(const Path& src_path, const Path& dest_path) const = 0; | 103 | virtual ResultCode CreateDirectory(const Path& path) const = 0; |
| 106 | 104 | ||
| 107 | /** | 105 | /** |
| 108 | * Delete a directory specified by its path | 106 | * Delete a directory specified by its path |
| @@ -119,19 +117,12 @@ public: | |||
| 119 | virtual ResultCode DeleteDirectoryRecursively(const Path& path) const = 0; | 117 | virtual ResultCode DeleteDirectoryRecursively(const Path& path) const = 0; |
| 120 | 118 | ||
| 121 | /** | 119 | /** |
| 122 | * Create a file specified by its path | 120 | * Rename a File specified by its path |
| 123 | * @param path Path relative to the Archive | 121 | * @param src_path Source path relative to the archive |
| 124 | * @param size The size of the new file, filled with zeroes | 122 | * @param dest_path Destination path relative to the archive |
| 125 | * @return Result of the operation | ||
| 126 | */ | ||
| 127 | virtual ResultCode CreateFile(const Path& path, u64 size) const = 0; | ||
| 128 | |||
| 129 | /** | ||
| 130 | * Create a directory specified by its path | ||
| 131 | * @param path Path relative to the archive | ||
| 132 | * @return Result of the operation | 123 | * @return Result of the operation |
| 133 | */ | 124 | */ |
| 134 | virtual ResultCode CreateDirectory(const Path& path) const = 0; | 125 | virtual ResultCode RenameFile(const Path& src_path, const Path& dest_path) const = 0; |
| 135 | 126 | ||
| 136 | /** | 127 | /** |
| 137 | * Rename a Directory specified by its path | 128 | * Rename a Directory specified by its path |
| @@ -142,6 +133,15 @@ public: | |||
| 142 | virtual ResultCode RenameDirectory(const Path& src_path, const Path& dest_path) const = 0; | 133 | virtual ResultCode RenameDirectory(const Path& src_path, const Path& dest_path) const = 0; |
| 143 | 134 | ||
| 144 | /** | 135 | /** |
| 136 | * Open a file specified by its path, using the specified mode | ||
| 137 | * @param path Path relative to the archive | ||
| 138 | * @param mode Mode to open the file with | ||
| 139 | * @return Opened file, or error code | ||
| 140 | */ | ||
| 141 | virtual ResultVal<std::unique_ptr<FileBackend>> OpenFile(const Path& path, | ||
| 142 | const Mode& mode) const = 0; | ||
| 143 | |||
| 144 | /** | ||
| 145 | * Open a directory specified by its path | 145 | * Open a directory specified by its path |
| 146 | * @param path Path relative to the archive | 146 | * @param path Path relative to the archive |
| 147 | * @return Opened directory, or error code | 147 | * @return Opened directory, or error code |
| @@ -152,7 +152,7 @@ public: | |||
| 152 | * Get the free space | 152 | * Get the free space |
| 153 | * @return The number of free bytes in the archive | 153 | * @return The number of free bytes in the archive |
| 154 | */ | 154 | */ |
| 155 | virtual u64 GetFreeBytes() const = 0; | 155 | virtual u64 GetFreeSpaceSize() const = 0; |
| 156 | }; | 156 | }; |
| 157 | 157 | ||
| 158 | class ArchiveFactory : NonCopyable { | 158 | class ArchiveFactory : NonCopyable { |
diff --git a/src/core/file_sys/romfs_archive.cpp b/src/core/file_sys/romfs_archive.cpp index 482de2220..0d93fccd4 100644 --- a/src/core/file_sys/romfs_archive.cpp +++ b/src/core/file_sys/romfs_archive.cpp | |||
| @@ -73,7 +73,7 @@ ResultVal<std::unique_ptr<DirectoryBackend>> ROMFSArchive::OpenDirectory(const P | |||
| 73 | return MakeResult<std::unique_ptr<DirectoryBackend>>(std::make_unique<ROMFSDirectory>()); | 73 | return MakeResult<std::unique_ptr<DirectoryBackend>>(std::make_unique<ROMFSDirectory>()); |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | u64 ROMFSArchive::GetFreeBytes() const { | 76 | u64 ROMFSArchive::GetFreeSpaceSize() const { |
| 77 | LOG_WARNING(Service_FS, "Attempted to get the free space in an ROMFS archive"); | 77 | LOG_WARNING(Service_FS, "Attempted to get the free space in an ROMFS archive"); |
| 78 | return 0; | 78 | return 0; |
| 79 | } | 79 | } |
diff --git a/src/core/file_sys/romfs_archive.h b/src/core/file_sys/romfs_archive.h index 2bb13146b..2b6c573ba 100644 --- a/src/core/file_sys/romfs_archive.h +++ b/src/core/file_sys/romfs_archive.h | |||
| @@ -39,7 +39,7 @@ public: | |||
| 39 | ResultCode CreateDirectory(const Path& path) const override; | 39 | ResultCode CreateDirectory(const Path& path) const override; |
| 40 | ResultCode RenameDirectory(const Path& src_path, const Path& dest_path) const override; | 40 | ResultCode RenameDirectory(const Path& src_path, const Path& dest_path) const override; |
| 41 | ResultVal<std::unique_ptr<DirectoryBackend>> OpenDirectory(const Path& path) const override; | 41 | ResultVal<std::unique_ptr<DirectoryBackend>> OpenDirectory(const Path& path) const override; |
| 42 | u64 GetFreeBytes() const override; | 42 | u64 GetFreeSpaceSize() const override; |
| 43 | 43 | ||
| 44 | protected: | 44 | protected: |
| 45 | std::shared_ptr<FileUtil::IOFile> romfs_file; | 45 | std::shared_ptr<FileUtil::IOFile> romfs_file; |
diff --git a/src/core/file_sys/savedata_archive.cpp b/src/core/file_sys/savedata_archive.cpp index d7b012f6e..d12739ca7 100644 --- a/src/core/file_sys/savedata_archive.cpp +++ b/src/core/file_sys/savedata_archive.cpp | |||
| @@ -322,7 +322,7 @@ ResultVal<std::unique_ptr<DirectoryBackend>> SaveDataArchive::OpenDirectory( | |||
| 322 | return MakeResult<std::unique_ptr<DirectoryBackend>>(std::move(directory)); | 322 | return MakeResult<std::unique_ptr<DirectoryBackend>>(std::move(directory)); |
| 323 | } | 323 | } |
| 324 | 324 | ||
| 325 | u64 SaveDataArchive::GetFreeBytes() const { | 325 | u64 SaveDataArchive::GetFreeSpaceSize() const { |
| 326 | // TODO: Stubbed to return 1GiB | 326 | // TODO: Stubbed to return 1GiB |
| 327 | return 1024 * 1024 * 1024; | 327 | return 1024 * 1024 * 1024; |
| 328 | } | 328 | } |
diff --git a/src/core/file_sys/savedata_archive.h b/src/core/file_sys/savedata_archive.h index 176d35710..931dfb17b 100644 --- a/src/core/file_sys/savedata_archive.h +++ b/src/core/file_sys/savedata_archive.h | |||
| @@ -34,7 +34,7 @@ public: | |||
| 34 | ResultCode CreateDirectory(const Path& path) const override; | 34 | ResultCode CreateDirectory(const Path& path) const override; |
| 35 | ResultCode RenameDirectory(const Path& src_path, const Path& dest_path) const override; | 35 | ResultCode RenameDirectory(const Path& src_path, const Path& dest_path) const override; |
| 36 | ResultVal<std::unique_ptr<DirectoryBackend>> OpenDirectory(const Path& path) const override; | 36 | ResultVal<std::unique_ptr<DirectoryBackend>> OpenDirectory(const Path& path) const override; |
| 37 | u64 GetFreeBytes() const override; | 37 | u64 GetFreeSpaceSize() const override; |
| 38 | 38 | ||
| 39 | protected: | 39 | protected: |
| 40 | std::string mount_point; | 40 | std::string mount_point; |