summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2018-03-20 05:00:37 +0100
committerSubv <subv2112@gmail.com>2018-03-20 05:00:37 +0100
commit6d90d99d12c6a1e7ec27831d93052a30c0e689b5 (patch)
tree8ec3a73b6ca0d6a2e3cc88e2a108eeb68ba19327 /src/core
parentFS: Implement DiskFileSystem::GetEntryType for existing files/directories. (diff)
downloadyuzu-6d90d99d12c6a1e7ec27831d93052a30c0e689b5.tar
yuzu-6d90d99d12c6a1e7ec27831d93052a30c0e689b5.tar.gz
yuzu-6d90d99d12c6a1e7ec27831d93052a30c0e689b5.tar.bz2
yuzu-6d90d99d12c6a1e7ec27831d93052a30c0e689b5.tar.lz
yuzu-6d90d99d12c6a1e7ec27831d93052a30c0e689b5.tar.xz
yuzu-6d90d99d12c6a1e7ec27831d93052a30c0e689b5.tar.zst
yuzu-6d90d99d12c6a1e7ec27831d93052a30c0e689b5.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/file_sys/disk_filesystem.cpp13
-rw-r--r--src/core/file_sys/disk_filesystem.h3
-rw-r--r--src/core/file_sys/filesystem.h3
-rw-r--r--src/core/file_sys/romfs_filesystem.cpp3
-rw-r--r--src/core/file_sys/romfs_filesystem.h3
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
}
ResultVal<std::unique_ptr<DirectoryBackend>> Disk_FileSystem::OpenDirectory(
- const Path& path) const {
- return MakeResult<std::unique_ptr<DirectoryBackend>>(std::make_unique<Disk_Directory>());
+ const std::string& path) const {
+
+ std::string full_path = base_directory + path;
+
+ if (!FileUtil::IsDirectory(full_path)) {
+ // TODO(Subv): Find the correct error code for this.
+ return ResultCode(-1);
+ }
+
+ auto directory = std::make_unique<Disk_Directory>(full_path);
+ return MakeResult<std::unique_ptr<DirectoryBackend>>(std::move(directory));
}
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:
ResultCode CreateFile(const std::string& path, u64 size) const override;
ResultCode CreateDirectory(const Path& path) const override;
ResultCode RenameDirectory(const Path& src_path, const Path& dest_path) const override;
- ResultVal<std::unique_ptr<DirectoryBackend>> OpenDirectory(const Path& path) const override;
+ ResultVal<std::unique_ptr<DirectoryBackend>> OpenDirectory(
+ const std::string& path) const override;
u64 GetFreeSpaceSize() const override;
ResultVal<EntryType> GetEntryType(const std::string& path) const override;
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:
* @param path Path relative to the archive
* @return Opened directory, or error code
*/
- virtual ResultVal<std::unique_ptr<DirectoryBackend>> OpenDirectory(const Path& path) const = 0;
+ virtual ResultVal<std::unique_ptr<DirectoryBackend>> OpenDirectory(
+ const std::string& path) const = 0;
/**
* 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
}
ResultVal<std::unique_ptr<DirectoryBackend>> RomFS_FileSystem::OpenDirectory(
- const Path& path) const {
+ const std::string& path) const {
+ LOG_WARNING(Service_FS, "Opening Directory in a ROMFS archive");
return MakeResult<std::unique_ptr<DirectoryBackend>>(std::make_unique<ROMFSDirectory>());
}
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:
ResultCode CreateFile(const std::string& path, u64 size) const override;
ResultCode CreateDirectory(const Path& path) const override;
ResultCode RenameDirectory(const Path& src_path, const Path& dest_path) const override;
- ResultVal<std::unique_ptr<DirectoryBackend>> OpenDirectory(const Path& path) const override;
+ ResultVal<std::unique_ptr<DirectoryBackend>> OpenDirectory(
+ const std::string& path) const override;
u64 GetFreeSpaceSize() const override;
ResultVal<EntryType> GetEntryType(const std::string& path) const override;