diff options
Diffstat (limited to 'src/core/file_sys')
| -rw-r--r-- | src/core/file_sys/disk_filesystem.cpp | 13 | ||||
| -rw-r--r-- | src/core/file_sys/disk_filesystem.h | 3 | ||||
| -rw-r--r-- | src/core/file_sys/filesystem.h | 3 | ||||
| -rw-r--r-- | src/core/file_sys/romfs_filesystem.cpp | 3 | ||||
| -rw-r--r-- | src/core/file_sys/romfs_filesystem.h | 3 |
5 files changed, 19 insertions, 6 deletions
diff --git a/src/core/file_sys/disk_filesystem.cpp b/src/core/file_sys/disk_filesystem.cpp index e02b20faf..f620b7961 100644 --- a/src/core/file_sys/disk_filesystem.cpp +++ b/src/core/file_sys/disk_filesystem.cpp | |||
| @@ -108,8 +108,17 @@ ResultCode Disk_FileSystem::RenameDirectory(const Path& src_path, const Path& de | |||
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | ResultVal<std::unique_ptr<DirectoryBackend>> Disk_FileSystem::OpenDirectory( | 110 | ResultVal<std::unique_ptr<DirectoryBackend>> Disk_FileSystem::OpenDirectory( |
| 111 | const Path& path) const { | 111 | const std::string& path) const { |
| 112 | return MakeResult<std::unique_ptr<DirectoryBackend>>(std::make_unique<Disk_Directory>()); | 112 | |
| 113 | std::string full_path = base_directory + path; | ||
| 114 | |||
| 115 | if (!FileUtil::IsDirectory(full_path)) { | ||
| 116 | // TODO(Subv): Find the correct error code for this. | ||
| 117 | return ResultCode(-1); | ||
| 118 | } | ||
| 119 | |||
| 120 | auto directory = std::make_unique<Disk_Directory>(full_path); | ||
| 121 | return MakeResult<std::unique_ptr<DirectoryBackend>>(std::move(directory)); | ||
| 113 | } | 122 | } |
| 114 | 123 | ||
| 115 | u64 Disk_FileSystem::GetFreeSpaceSize() const { | 124 | u64 Disk_FileSystem::GetFreeSpaceSize() const { |
diff --git a/src/core/file_sys/disk_filesystem.h b/src/core/file_sys/disk_filesystem.h index 29383dbf7..72a0afedf 100644 --- a/src/core/file_sys/disk_filesystem.h +++ b/src/core/file_sys/disk_filesystem.h | |||
| @@ -32,7 +32,8 @@ public: | |||
| 32 | ResultCode CreateFile(const std::string& path, u64 size) const override; | 32 | ResultCode CreateFile(const std::string& path, u64 size) const override; |
| 33 | ResultCode CreateDirectory(const Path& path) const override; | 33 | ResultCode CreateDirectory(const Path& path) const override; |
| 34 | ResultCode RenameDirectory(const Path& src_path, const Path& dest_path) const override; | 34 | ResultCode RenameDirectory(const Path& src_path, const Path& dest_path) const override; |
| 35 | ResultVal<std::unique_ptr<DirectoryBackend>> OpenDirectory(const Path& path) const override; | 35 | ResultVal<std::unique_ptr<DirectoryBackend>> OpenDirectory( |
| 36 | const std::string& path) const override; | ||
| 36 | u64 GetFreeSpaceSize() const override; | 37 | u64 GetFreeSpaceSize() const override; |
| 37 | ResultVal<EntryType> GetEntryType(const std::string& path) const override; | 38 | ResultVal<EntryType> GetEntryType(const std::string& path) const override; |
| 38 | 39 | ||
diff --git a/src/core/file_sys/filesystem.h b/src/core/file_sys/filesystem.h index 5c91a46c2..22ad24143 100644 --- a/src/core/file_sys/filesystem.h +++ b/src/core/file_sys/filesystem.h | |||
| @@ -150,7 +150,8 @@ public: | |||
| 150 | * @param path Path relative to the archive | 150 | * @param path Path relative to the archive |
| 151 | * @return Opened directory, or error code | 151 | * @return Opened directory, or error code |
| 152 | */ | 152 | */ |
| 153 | virtual ResultVal<std::unique_ptr<DirectoryBackend>> OpenDirectory(const Path& path) const = 0; | 153 | virtual ResultVal<std::unique_ptr<DirectoryBackend>> OpenDirectory( |
| 154 | const std::string& path) const = 0; | ||
| 154 | 155 | ||
| 155 | /** | 156 | /** |
| 156 | * Get the free space | 157 | * Get the free space |
diff --git a/src/core/file_sys/romfs_filesystem.cpp b/src/core/file_sys/romfs_filesystem.cpp index f1f9b4d04..169f0d4f6 100644 --- a/src/core/file_sys/romfs_filesystem.cpp +++ b/src/core/file_sys/romfs_filesystem.cpp | |||
| @@ -70,7 +70,8 @@ ResultCode RomFS_FileSystem::RenameDirectory(const Path& src_path, const Path& d | |||
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | ResultVal<std::unique_ptr<DirectoryBackend>> RomFS_FileSystem::OpenDirectory( | 72 | ResultVal<std::unique_ptr<DirectoryBackend>> RomFS_FileSystem::OpenDirectory( |
| 73 | const Path& path) const { | 73 | const std::string& path) const { |
| 74 | LOG_WARNING(Service_FS, "Opening Directory in a ROMFS archive"); | ||
| 74 | return MakeResult<std::unique_ptr<DirectoryBackend>>(std::make_unique<ROMFSDirectory>()); | 75 | return MakeResult<std::unique_ptr<DirectoryBackend>>(std::make_unique<ROMFSDirectory>()); |
| 75 | } | 76 | } |
| 76 | 77 | ||
diff --git a/src/core/file_sys/romfs_filesystem.h b/src/core/file_sys/romfs_filesystem.h index be52f20ef..ee41c2d02 100644 --- a/src/core/file_sys/romfs_filesystem.h +++ b/src/core/file_sys/romfs_filesystem.h | |||
| @@ -38,7 +38,8 @@ public: | |||
| 38 | ResultCode CreateFile(const std::string& path, u64 size) const override; | 38 | ResultCode CreateFile(const std::string& path, u64 size) const override; |
| 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( |
| 42 | const std::string& path) const override; | ||
| 42 | u64 GetFreeSpaceSize() const override; | 43 | u64 GetFreeSpaceSize() const override; |
| 43 | ResultVal<EntryType> GetEntryType(const std::string& path) const override; | 44 | ResultVal<EntryType> GetEntryType(const std::string& path) const override; |
| 44 | 45 | ||