aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/file_sys/disk_archive.h
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner <yuriks@yuriks.net>2015-02-06 11:53:14 -0200
committerGravatar Yuri Kunde Schlesner <yuriks@yuriks.net>2015-02-10 13:43:44 -0200
commit3f1a3952d707bce7851652ce54701ca14334f314 (patch)
tree04c79ff9887f0074813276cdf989e6814901e943 /src/core/file_sys/disk_archive.h
parent4468625080c9388f2fe81a791e8295e6961e96f5 (diff)
FS: Allow multiple instances of the same archive type to be open at once
Diffstat (limited to 'src/core/file_sys/disk_archive.h')
-rw-r--r--src/core/file_sys/disk_archive.h25
1 files changed, 7 insertions, 18 deletions
diff --git a/src/core/file_sys/disk_archive.h b/src/core/file_sys/disk_archive.h
index 3472f687..dbbdced7 100644
--- a/src/core/file_sys/disk_archive.h
+++ b/src/core/file_sys/disk_archive.h
@@ -24,8 +24,8 @@ class DiskArchive : public ArchiveBackend {
public:
DiskArchive(const std::string& mount_point_) : mount_point(mount_point_) {}
- virtual std::string GetName() const = 0;
- virtual ResultCode Format(const Path& path) const { return RESULT_SUCCESS; }
+ virtual std::string GetName() const { return "DiskArchive: " + mount_point; }
+
std::unique_ptr<FileBackend> OpenFile(const Path& path, const Mode mode) const override;
bool DeleteFile(const Path& path) const override;
bool RenameFile(const Path& src_path, const Path& dest_path) const override;
@@ -35,26 +35,17 @@ public:
bool RenameDirectory(const Path& src_path, const Path& dest_path) const override;
std::unique_ptr<DirectoryBackend> OpenDirectory(const Path& path) const override;
- virtual ResultCode Open(const Path& path) override {
- return RESULT_SUCCESS;
- }
-
- /**
- * Getter for the path used for this Archive
- * @return Mount point of that passthrough archive
- */
- virtual const std::string& GetMountPoint() const {
- return mount_point;
- }
-
protected:
+ friend class DiskFile;
+ friend class DiskDirectory;
+
std::string mount_point;
};
class DiskFile : public FileBackend {
public:
DiskFile();
- DiskFile(const DiskArchive* archive, const Path& path, const Mode mode);
+ DiskFile(const DiskArchive& archive, const Path& path, const Mode mode);
bool Open() override;
size_t Read(const u64 offset, const u32 length, u8* buffer) const override;
@@ -68,7 +59,6 @@ public:
}
protected:
- const DiskArchive* archive;
std::string path;
Mode mode;
std::unique_ptr<FileUtil::IOFile> file;
@@ -77,7 +67,7 @@ protected:
class DiskDirectory : public DirectoryBackend {
public:
DiskDirectory();
- DiskDirectory(const DiskArchive* archive, const Path& path);
+ DiskDirectory(const DiskArchive& archive, const Path& path);
~DiskDirectory() override {
Close();
@@ -91,7 +81,6 @@ public:
}
protected:
- const DiskArchive* archive;
std::string path;
u32 total_entries_in_directory;
FileUtil::FSTEntry directory;