diff options
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 @@ #include <regex> #include <mbedtls/sha256.h> #include "common/assert.h" +#include "common/file_util.h" #include "common/hex_util.h" #include "common/logging/log.h" -#include "core/crypto/encryption_layer.h" #include "core/file_sys/card_image.h" #include "core/file_sys/nca_metadata.h" #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 @@ #include <utility> #include "common/assert.h" #include "common/common_paths.h" +#include "common/file_util.h" #include "common/logging/log.h" #include "core/file_sys/vfs_real.h" @@ -39,6 +40,7 @@ static std::string ModeFlagsToString(Mode mode) { } RealVfsFilesystem::RealVfsFilesystem() : VfsFilesystem(nullptr) {} +RealVfsFilesystem::~RealVfsFilesystem() = default; std::string RealVfsFilesystem::GetName() const { return "Real"; @@ -219,6 +221,8 @@ RealVfsFile::RealVfsFile(RealVfsFilesystem& base_, std::shared_ptr<FileUtil::IOF parent_components(FileUtil::SliceVector(path_components, 0, path_components.size() - 1)), perms(perms_) {} +RealVfsFile::~RealVfsFile() = default; + std::string RealVfsFile::GetName() const { return path_components.back(); } @@ -312,6 +316,8 @@ RealVfsDirectory::RealVfsDirectory(RealVfsFilesystem& base_, const std::string& FileUtil::CreateDir(path); } +RealVfsDirectory::~RealVfsDirectory() = default; + std::shared_ptr<VfsFile> RealVfsDirectory::GetFileRelative(std::string_view path) const { const auto full_path = FileUtil::SanitizePath(this->path + DIR_SEP + std::string(path)); 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 @@ #include <string_view> #include <boost/container/flat_map.hpp> -#include "common/file_util.h" #include "core/file_sys/mode.h" #include "core/file_sys/vfs.h" +namespace FileUtil { +class IOFile; +} + namespace FileSys { class RealVfsFilesystem : public VfsFilesystem { public: RealVfsFilesystem(); + ~RealVfsFilesystem() override; std::string GetName() const override; bool IsReadable() const override; @@ -40,10 +44,9 @@ class RealVfsFile : public VfsFile { friend class RealVfsDirectory; friend class RealVfsFilesystem; - RealVfsFile(RealVfsFilesystem& base, std::shared_ptr<FileUtil::IOFile> backing, - const std::string& path, Mode perms = Mode::Read); - public: + ~RealVfsFile() override; + std::string GetName() const override; size_t GetSize() const override; bool Resize(size_t new_size) override; @@ -55,6 +58,9 @@ public: bool Rename(std::string_view name) override; private: + RealVfsFile(RealVfsFilesystem& base, std::shared_ptr<FileUtil::IOFile> backing, + const std::string& path, Mode perms = Mode::Read); + bool Close(); RealVfsFilesystem& base; @@ -70,9 +76,9 @@ private: class RealVfsDirectory : public VfsDirectory { friend class RealVfsFilesystem; - RealVfsDirectory(RealVfsFilesystem& base, const std::string& path, Mode perms = Mode::Read); - public: + ~RealVfsDirectory() override; + std::shared_ptr<VfsFile> GetFileRelative(std::string_view path) const override; std::shared_ptr<VfsDirectory> GetDirectoryRelative(std::string_view path) const override; std::shared_ptr<VfsFile> GetFile(std::string_view name) const override; @@ -97,6 +103,8 @@ protected: bool ReplaceFileWithSubdirectory(VirtualFile file, VirtualDir dir) override; private: + RealVfsDirectory(RealVfsFilesystem& base, const std::string& path, Mode perms = Mode::Read); + template <typename T, typename R> std::vector<std::shared_ptr<R>> IterateEntries() const; 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 @@ #include <mbedtls/md.h> #include <mbedtls/sha256.h> #include "common/assert.h" +#include "common/file_util.h" #include "common/hex_util.h" #include "common/logging/log.h" #include "core/crypto/aes_util.h" |