diff options
| author | 2018-09-02 10:53:06 -0400 | |
|---|---|---|
| committer | 2018-09-02 12:38:14 -0400 | |
| commit | a40537314405d62baa012836da9bba24ad4b02e5 (patch) | |
| tree | e713eda9ce20870d7e803989d555e7842eab3415 /src/core/file_sys | |
| parent | Merge pull request #1213 from DarkLordZach/octopath-fs (diff) | |
| download | yuzu-a40537314405d62baa012836da9bba24ad4b02e5.tar.gz yuzu-a40537314405d62baa012836da9bba24ad4b02e5.tar.xz yuzu-a40537314405d62baa012836da9bba24ad4b02e5.zip | |
vfs_real: Forward declare IOFile
Eliminates the need to rebuild some source files if the file_util header
ever changes. This also uncovered some indirect inclusions, which have
also been fixed.
Diffstat (limited to 'src/core/file_sys')
| -rw-r--r-- | src/core/file_sys/registered_cache.cpp | 2 | ||||
| -rw-r--r-- | src/core/file_sys/vfs_real.cpp | 6 | ||||
| -rw-r--r-- | src/core/file_sys/vfs_real.h | 20 | ||||
| -rw-r--r-- | src/core/file_sys/xts_archive.cpp | 1 |
4 files changed, 22 insertions, 7 deletions
diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp index dacf8568b..fe5d36930 100644 --- a/src/core/file_sys/registered_cache.cpp +++ b/src/core/file_sys/registered_cache.cpp | |||
| @@ -5,9 +5,9 @@ | |||
| 5 | #include <regex> | 5 | #include <regex> |
| 6 | #include <mbedtls/sha256.h> | 6 | #include <mbedtls/sha256.h> |
| 7 | #include "common/assert.h" | 7 | #include "common/assert.h" |
| 8 | #include "common/file_util.h" | ||
| 8 | #include "common/hex_util.h" | 9 | #include "common/hex_util.h" |
| 9 | #include "common/logging/log.h" | 10 | #include "common/logging/log.h" |
| 10 | #include "core/crypto/encryption_layer.h" | ||
| 11 | #include "core/file_sys/card_image.h" | 11 | #include "core/file_sys/card_image.h" |
| 12 | #include "core/file_sys/nca_metadata.h" | 12 | #include "core/file_sys/nca_metadata.h" |
| 13 | #include "core/file_sys/registered_cache.h" | 13 | #include "core/file_sys/registered_cache.h" |
diff --git a/src/core/file_sys/vfs_real.cpp b/src/core/file_sys/vfs_real.cpp index 2b8ac7103..89b101145 100644 --- a/src/core/file_sys/vfs_real.cpp +++ b/src/core/file_sys/vfs_real.cpp | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include <utility> | 8 | #include <utility> |
| 9 | #include "common/assert.h" | 9 | #include "common/assert.h" |
| 10 | #include "common/common_paths.h" | 10 | #include "common/common_paths.h" |
| 11 | #include "common/file_util.h" | ||
| 11 | #include "common/logging/log.h" | 12 | #include "common/logging/log.h" |
| 12 | #include "core/file_sys/vfs_real.h" | 13 | #include "core/file_sys/vfs_real.h" |
| 13 | 14 | ||
| @@ -39,6 +40,7 @@ static std::string ModeFlagsToString(Mode mode) { | |||
| 39 | } | 40 | } |
| 40 | 41 | ||
| 41 | RealVfsFilesystem::RealVfsFilesystem() : VfsFilesystem(nullptr) {} | 42 | RealVfsFilesystem::RealVfsFilesystem() : VfsFilesystem(nullptr) {} |
| 43 | RealVfsFilesystem::~RealVfsFilesystem() = default; | ||
| 42 | 44 | ||
| 43 | std::string RealVfsFilesystem::GetName() const { | 45 | std::string RealVfsFilesystem::GetName() const { |
| 44 | return "Real"; | 46 | return "Real"; |
| @@ -219,6 +221,8 @@ RealVfsFile::RealVfsFile(RealVfsFilesystem& base_, std::shared_ptr<FileUtil::IOF | |||
| 219 | parent_components(FileUtil::SliceVector(path_components, 0, path_components.size() - 1)), | 221 | parent_components(FileUtil::SliceVector(path_components, 0, path_components.size() - 1)), |
| 220 | perms(perms_) {} | 222 | perms(perms_) {} |
| 221 | 223 | ||
| 224 | RealVfsFile::~RealVfsFile() = default; | ||
| 225 | |||
| 222 | std::string RealVfsFile::GetName() const { | 226 | std::string RealVfsFile::GetName() const { |
| 223 | return path_components.back(); | 227 | return path_components.back(); |
| 224 | } | 228 | } |
| @@ -312,6 +316,8 @@ RealVfsDirectory::RealVfsDirectory(RealVfsFilesystem& base_, const std::string& | |||
| 312 | FileUtil::CreateDir(path); | 316 | FileUtil::CreateDir(path); |
| 313 | } | 317 | } |
| 314 | 318 | ||
| 319 | RealVfsDirectory::~RealVfsDirectory() = default; | ||
| 320 | |||
| 315 | std::shared_ptr<VfsFile> RealVfsDirectory::GetFileRelative(std::string_view path) const { | 321 | std::shared_ptr<VfsFile> RealVfsDirectory::GetFileRelative(std::string_view path) const { |
| 316 | const auto full_path = FileUtil::SanitizePath(this->path + DIR_SEP + std::string(path)); | 322 | const auto full_path = FileUtil::SanitizePath(this->path + DIR_SEP + std::string(path)); |
| 317 | if (!FileUtil::Exists(full_path) || FileUtil::IsDirectory(full_path)) | 323 | if (!FileUtil::Exists(full_path) || FileUtil::IsDirectory(full_path)) |
diff --git a/src/core/file_sys/vfs_real.h b/src/core/file_sys/vfs_real.h index 989803d43..7db86691f 100644 --- a/src/core/file_sys/vfs_real.h +++ b/src/core/file_sys/vfs_real.h | |||
| @@ -6,15 +6,19 @@ | |||
| 6 | 6 | ||
| 7 | #include <string_view> | 7 | #include <string_view> |
| 8 | #include <boost/container/flat_map.hpp> | 8 | #include <boost/container/flat_map.hpp> |
| 9 | #include "common/file_util.h" | ||
| 10 | #include "core/file_sys/mode.h" | 9 | #include "core/file_sys/mode.h" |
| 11 | #include "core/file_sys/vfs.h" | 10 | #include "core/file_sys/vfs.h" |
| 12 | 11 | ||
| 12 | namespace FileUtil { | ||
| 13 | class IOFile; | ||
| 14 | } | ||
| 15 | |||
| 13 | namespace FileSys { | 16 | namespace FileSys { |
| 14 | 17 | ||
| 15 | class RealVfsFilesystem : public VfsFilesystem { | 18 | class RealVfsFilesystem : public VfsFilesystem { |
| 16 | public: | 19 | public: |
| 17 | RealVfsFilesystem(); | 20 | RealVfsFilesystem(); |
| 21 | ~RealVfsFilesystem() override; | ||
| 18 | 22 | ||
| 19 | std::string GetName() const override; | 23 | std::string GetName() const override; |
| 20 | bool IsReadable() const override; | 24 | bool IsReadable() const override; |
| @@ -40,10 +44,9 @@ class RealVfsFile : public VfsFile { | |||
| 40 | friend class RealVfsDirectory; | 44 | friend class RealVfsDirectory; |
| 41 | friend class RealVfsFilesystem; | 45 | friend class RealVfsFilesystem; |
| 42 | 46 | ||
| 43 | RealVfsFile(RealVfsFilesystem& base, std::shared_ptr<FileUtil::IOFile> backing, | ||
| 44 | const std::string& path, Mode perms = Mode::Read); | ||
| 45 | |||
| 46 | public: | 47 | public: |
| 48 | ~RealVfsFile() override; | ||
| 49 | |||
| 47 | std::string GetName() const override; | 50 | std::string GetName() const override; |
| 48 | size_t GetSize() const override; | 51 | size_t GetSize() const override; |
| 49 | bool Resize(size_t new_size) override; | 52 | bool Resize(size_t new_size) override; |
| @@ -55,6 +58,9 @@ public: | |||
| 55 | bool Rename(std::string_view name) override; | 58 | bool Rename(std::string_view name) override; |
| 56 | 59 | ||
| 57 | private: | 60 | private: |
| 61 | RealVfsFile(RealVfsFilesystem& base, std::shared_ptr<FileUtil::IOFile> backing, | ||
| 62 | const std::string& path, Mode perms = Mode::Read); | ||
| 63 | |||
| 58 | bool Close(); | 64 | bool Close(); |
| 59 | 65 | ||
| 60 | RealVfsFilesystem& base; | 66 | RealVfsFilesystem& base; |
| @@ -70,9 +76,9 @@ private: | |||
| 70 | class RealVfsDirectory : public VfsDirectory { | 76 | class RealVfsDirectory : public VfsDirectory { |
| 71 | friend class RealVfsFilesystem; | 77 | friend class RealVfsFilesystem; |
| 72 | 78 | ||
| 73 | RealVfsDirectory(RealVfsFilesystem& base, const std::string& path, Mode perms = Mode::Read); | ||
| 74 | |||
| 75 | public: | 79 | public: |
| 80 | ~RealVfsDirectory() override; | ||
| 81 | |||
| 76 | std::shared_ptr<VfsFile> GetFileRelative(std::string_view path) const override; | 82 | std::shared_ptr<VfsFile> GetFileRelative(std::string_view path) const override; |
| 77 | std::shared_ptr<VfsDirectory> GetDirectoryRelative(std::string_view path) const override; | 83 | std::shared_ptr<VfsDirectory> GetDirectoryRelative(std::string_view path) const override; |
| 78 | std::shared_ptr<VfsFile> GetFile(std::string_view name) const override; | 84 | std::shared_ptr<VfsFile> GetFile(std::string_view name) const override; |
| @@ -97,6 +103,8 @@ protected: | |||
| 97 | bool ReplaceFileWithSubdirectory(VirtualFile file, VirtualDir dir) override; | 103 | bool ReplaceFileWithSubdirectory(VirtualFile file, VirtualDir dir) override; |
| 98 | 104 | ||
| 99 | private: | 105 | private: |
| 106 | RealVfsDirectory(RealVfsFilesystem& base, const std::string& path, Mode perms = Mode::Read); | ||
| 107 | |||
| 100 | template <typename T, typename R> | 108 | template <typename T, typename R> |
| 101 | std::vector<std::shared_ptr<R>> IterateEntries() const; | 109 | std::vector<std::shared_ptr<R>> IterateEntries() const; |
| 102 | 110 | ||
diff --git a/src/core/file_sys/xts_archive.cpp b/src/core/file_sys/xts_archive.cpp index 552835738..4dbc25c55 100644 --- a/src/core/file_sys/xts_archive.cpp +++ b/src/core/file_sys/xts_archive.cpp | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include <mbedtls/md.h> | 10 | #include <mbedtls/md.h> |
| 11 | #include <mbedtls/sha256.h> | 11 | #include <mbedtls/sha256.h> |
| 12 | #include "common/assert.h" | 12 | #include "common/assert.h" |
| 13 | #include "common/file_util.h" | ||
| 13 | #include "common/hex_util.h" | 14 | #include "common/hex_util.h" |
| 14 | #include "common/logging/log.h" | 15 | #include "common/logging/log.h" |
| 15 | #include "core/crypto/aes_util.h" | 16 | #include "core/crypto/aes_util.h" |