diff options
author | Sebastian Valle <subv2112@gmail.com> | 2016-11-28 00:56:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-28 00:56:56 +0100 |
commit | 4ba5acdaff19f5334b86e86c324763d4e9b969b0 (patch) | |
tree | 408343a46858bcde292744d89fc6b3dadd9a54b0 /src/core/file_sys/disk_archive.h | |
parent | Merge pull request #2218 from Subv/stencil_lines (diff) | |
parent | tests: add a work-around for macOS linking error (diff) | |
download | yuzu-4ba5acdaff19f5334b86e86c324763d4e9b969b0.tar yuzu-4ba5acdaff19f5334b86e86c324763d4e9b969b0.tar.gz yuzu-4ba5acdaff19f5334b86e86c324763d4e9b969b0.tar.bz2 yuzu-4ba5acdaff19f5334b86e86c324763d4e9b969b0.tar.lz yuzu-4ba5acdaff19f5334b86e86c324763d4e9b969b0.tar.xz yuzu-4ba5acdaff19f5334b86e86c324763d4e9b969b0.tar.zst yuzu-4ba5acdaff19f5334b86e86c324763d4e9b969b0.zip |
Diffstat (limited to 'src/core/file_sys/disk_archive.h')
-rw-r--r-- | src/core/file_sys/disk_archive.h | 43 |
1 files changed, 5 insertions, 38 deletions
diff --git a/src/core/file_sys/disk_archive.h b/src/core/file_sys/disk_archive.h index 59ebb2002..eb9166df6 100644 --- a/src/core/file_sys/disk_archive.h +++ b/src/core/file_sys/disk_archive.h @@ -20,43 +20,13 @@ namespace FileSys { -/** - * Helper which implements a backend accessing the host machine's filesystem. - * This should be subclassed by concrete archive types, which will provide the - * base directory on the host filesystem and override any required functionality. - */ -class DiskArchive : public ArchiveBackend { -public: - DiskArchive(const std::string& mount_point_) : mount_point(mount_point_) {} - - virtual std::string GetName() const override { - return "DiskArchive: " + mount_point; - } - - ResultVal<std::unique_ptr<FileBackend>> OpenFile(const Path& path, - const Mode mode) const override; - ResultCode DeleteFile(const Path& path) const override; - bool RenameFile(const Path& src_path, const Path& dest_path) const override; - bool DeleteDirectory(const Path& path) const override; - bool DeleteDirectoryRecursively(const Path& path) const override; - ResultCode CreateFile(const Path& path, u64 size) const override; - bool CreateDirectory(const Path& path) const override; - bool RenameDirectory(const Path& src_path, const Path& dest_path) const override; - std::unique_ptr<DirectoryBackend> OpenDirectory(const Path& path) const override; - u64 GetFreeBytes() const override; - -protected: - friend class DiskFile; - friend class DiskDirectory; - - std::string mount_point; -}; - class DiskFile : public FileBackend { public: - DiskFile(const DiskArchive& archive, const Path& path, const Mode mode); + DiskFile(FileUtil::IOFile&& file_, const Mode& mode_) + : file(new FileUtil::IOFile(std::move(file_))) { + mode.hex = mode_.hex; + } - ResultCode Open() override; ResultVal<size_t> Read(u64 offset, size_t length, u8* buffer) const override; ResultVal<size_t> Write(u64 offset, size_t length, bool flush, const u8* buffer) const override; u64 GetSize() const override; @@ -68,20 +38,18 @@ public: } protected: - std::string path; Mode mode; std::unique_ptr<FileUtil::IOFile> file; }; class DiskDirectory : public DirectoryBackend { public: - DiskDirectory(const DiskArchive& archive, const Path& path); + DiskDirectory(const std::string& path); ~DiskDirectory() override { Close(); } - bool Open() override; u32 Read(const u32 count, Entry* entries) override; bool Close() const override { @@ -89,7 +57,6 @@ public: } protected: - std::string path; u32 total_entries_in_directory; FileUtil::FSTEntry directory; |