diff options
Diffstat (limited to 'src/core/file_sys/vfs_real.cpp')
-rw-r--r-- | src/core/file_sys/vfs_real.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/core/file_sys/vfs_real.cpp b/src/core/file_sys/vfs_real.cpp index 488687ba9..a287eebe3 100644 --- a/src/core/file_sys/vfs_real.cpp +++ b/src/core/file_sys/vfs_real.cpp @@ -263,7 +263,7 @@ bool RealVfsFile::Resize(std::size_t new_size) { return backing->Resize(new_size); } -std::shared_ptr<VfsDirectory> RealVfsFile::GetContainingDirectory() const { +VirtualDir RealVfsFile::GetContainingDirectory() const { return base.OpenDirectory(parent_path, perms); } @@ -352,7 +352,7 @@ RealVfsDirectory::RealVfsDirectory(RealVfsFilesystem& base_, const std::string& RealVfsDirectory::~RealVfsDirectory() = default; -std::shared_ptr<VfsFile> RealVfsDirectory::GetFileRelative(std::string_view path) const { +VirtualFile RealVfsDirectory::GetFileRelative(std::string_view path) const { const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path)); if (!FS::Exists(full_path) || FS::IsDirectory(full_path)) { return nullptr; @@ -360,7 +360,7 @@ std::shared_ptr<VfsFile> RealVfsDirectory::GetFileRelative(std::string_view path return base.OpenFile(full_path, perms); } -std::shared_ptr<VfsDirectory> RealVfsDirectory::GetDirectoryRelative(std::string_view path) const { +VirtualDir RealVfsDirectory::GetDirectoryRelative(std::string_view path) const { const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path)); if (!FS::Exists(full_path) || !FS::IsDirectory(full_path)) { return nullptr; @@ -368,20 +368,20 @@ std::shared_ptr<VfsDirectory> RealVfsDirectory::GetDirectoryRelative(std::string return base.OpenDirectory(full_path, perms); } -std::shared_ptr<VfsFile> RealVfsDirectory::GetFile(std::string_view name) const { +VirtualFile RealVfsDirectory::GetFile(std::string_view name) const { return GetFileRelative(name); } -std::shared_ptr<VfsDirectory> RealVfsDirectory::GetSubdirectory(std::string_view name) const { +VirtualDir RealVfsDirectory::GetSubdirectory(std::string_view name) const { return GetDirectoryRelative(name); } -std::shared_ptr<VfsFile> RealVfsDirectory::CreateFileRelative(std::string_view path) { +VirtualFile RealVfsDirectory::CreateFileRelative(std::string_view path) { const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path)); return base.CreateFile(full_path, perms); } -std::shared_ptr<VfsDirectory> RealVfsDirectory::CreateDirectoryRelative(std::string_view path) { +VirtualDir RealVfsDirectory::CreateDirectoryRelative(std::string_view path) { const auto full_path = FS::SanitizePath(this->path + DIR_SEP + std::string(path)); return base.CreateDirectory(full_path, perms); } @@ -391,11 +391,11 @@ bool RealVfsDirectory::DeleteSubdirectoryRecursive(std::string_view name) { return base.DeleteDirectory(full_path); } -std::vector<std::shared_ptr<VfsFile>> RealVfsDirectory::GetFiles() const { +std::vector<VirtualFile> RealVfsDirectory::GetFiles() const { return IterateEntries<RealVfsFile, VfsFile>(); } -std::vector<std::shared_ptr<VfsDirectory>> RealVfsDirectory::GetSubdirectories() const { +std::vector<VirtualDir> RealVfsDirectory::GetSubdirectories() const { return IterateEntries<RealVfsDirectory, VfsDirectory>(); } @@ -411,7 +411,7 @@ std::string RealVfsDirectory::GetName() const { return path_components.back(); } -std::shared_ptr<VfsDirectory> RealVfsDirectory::GetParentDirectory() const { +VirtualDir RealVfsDirectory::GetParentDirectory() const { if (path_components.size() <= 1) { return nullptr; } @@ -419,12 +419,12 @@ std::shared_ptr<VfsDirectory> RealVfsDirectory::GetParentDirectory() const { return base.OpenDirectory(parent_path, perms); } -std::shared_ptr<VfsDirectory> RealVfsDirectory::CreateSubdirectory(std::string_view name) { +VirtualDir RealVfsDirectory::CreateSubdirectory(std::string_view name) { const std::string subdir_path = (path + DIR_SEP).append(name); return base.CreateDirectory(subdir_path, perms); } -std::shared_ptr<VfsFile> RealVfsDirectory::CreateFile(std::string_view name) { +VirtualFile RealVfsDirectory::CreateFile(std::string_view name) { const std::string file_path = (path + DIR_SEP).append(name); return base.CreateFile(file_path, perms); } |