ReXGlue SDK
Toggle main menu visibility
Loading...
Searching...
No Matches
file_system.h
Go to the documentation of this file.
1
10
11
#pragma once
12
13
#include <filesystem>
14
#include <memory>
15
#include <optional>
16
#include <span>
17
#include <string>
18
#include <string_view>
19
#include <vector>
20
21
#include <
rex/filesystem/directory.h
>
22
#include <
rex/filesystem/file.h
>
23
#include <
rex/filesystem/file_open.h
>
24
#include <
rex/filesystem/file_stat.h
>
25
#include <
rex/filesystem/file_system_error.h
>
26
#include <
rex/filesystem/mount.h
>
27
#include <
rex/memory/host.h
>
28
#include <
rex/result.h
>
29
#include <
rex/types.h
>
30
#include <
rex/utility.h
>
31
32
namespace
rex::filesystem {
33
34
inline
constexpr
memory::Tag
kFilesystem{7};
35
37
class
IFileSystem
:
public
NonCopyable {
38
public
:
39
virtual
~IFileSystem
() =
default
;
40
47
[[nodiscard]]
virtual
Result<void>
Mount
(
const
MountEntry
& entry) = 0;
48
54
[[nodiscard]]
virtual
Result<void>
Unmount
(std::string_view path) = 0;
55
56
[[nodiscard]]
virtual
std::vector<MountEntry> GetMounts()
const
= 0;
57
63
[[nodiscard]]
virtual
Result<void>
Link
(std::string_view link, std::string_view target) = 0;
64
70
[[nodiscard]]
virtual
Result<void>
Unlink
(std::string_view link) = 0;
71
76
[[nodiscard]]
virtual
std::optional<std::string>
FindLink
(std::string_view path)
const
= 0;
77
85
[[nodiscard]]
virtual
Result<void>
ConfigureStandardMounts
(
86
const
std::filesystem::path& game_root,
const
std::filesystem::path& update_root,
87
MountFlags
game_flags) = 0;
88
90
virtual
void
Clear
() = 0;
91
100
[[nodiscard]]
virtual
Result<Opened>
Open
(std::string_view path,
const
OpenOptions
& options) = 0;
101
108
[[nodiscard]]
virtual
Result<Opened>
OpenRelative
(
IFile
& root, std::string_view path,
109
const
OpenOptions
& options) = 0;
110
112
[[nodiscard]]
virtual
Result<FileStat>
Stat
(std::string_view path) = 0;
113
120
[[nodiscard]]
virtual
Result<std::unique_ptr<IDirectory>
>
List
(std::string_view path,
121
std::string_view pattern) = 0;
122
128
[[nodiscard]]
virtual
Result<void>
CreateDirectories
(std::string_view path) = 0;
129
135
[[nodiscard]]
virtual
Result<void>
Remove
(std::string_view path) = 0;
136
145
[[nodiscard]]
virtual
Result<void>
Rename
(std::string_view from, std::string_view to,
146
bool
replace_existing) = 0;
147
157
[[nodiscard]]
virtual
Result<void>
Rename
(
IFile
& file, std::string_view to,
bool
replace_existing,
158
IFile
* root =
nullptr
) = 0;
159
161
[[nodiscard]]
virtual
Result<VolumeStat>
GetVolume
(std::string_view path) = 0;
162
};
163
164
}
// namespace rex::filesystem
rex::filesystem::IFileSystem
Definition
file_system.h:37
rex::filesystem::IFileSystem::Rename
virtual Result< void > Rename(IFile &file, std::string_view to, bool replace_existing, IFile *root=nullptr)=0
rex::filesystem::IFileSystem::Unlink
virtual Result< void > Unlink(std::string_view link)=0
rex::filesystem::IFileSystem::Clear
virtual void Clear()=0
rex::filesystem::IFileSystem::Remove
virtual Result< void > Remove(std::string_view path)=0
rex::filesystem::IFileSystem::CreateDirectories
virtual Result< void > CreateDirectories(std::string_view path)=0
rex::filesystem::IFileSystem::OpenRelative
virtual Result< Opened > OpenRelative(IFile &root, std::string_view path, const OpenOptions &options)=0
rex::filesystem::IFileSystem::Mount
virtual Result< void > Mount(const MountEntry &entry)=0
rex::filesystem::IFileSystem::Rename
virtual Result< void > Rename(std::string_view from, std::string_view to, bool replace_existing)=0
rex::filesystem::IFileSystem::GetVolume
virtual Result< VolumeStat > GetVolume(std::string_view path)=0
rex::filesystem::IFileSystem::ConfigureStandardMounts
virtual Result< void > ConfigureStandardMounts(const std::filesystem::path &game_root, const std::filesystem::path &update_root, MountFlags game_flags)=0
rex::filesystem::IFileSystem::List
virtual Result< std::unique_ptr< IDirectory > > List(std::string_view path, std::string_view pattern)=0
rex::filesystem::IFileSystem::FindLink
virtual std::optional< std::string > FindLink(std::string_view path) const =0
rex::filesystem::IFileSystem::Link
virtual Result< void > Link(std::string_view link, std::string_view target)=0
rex::filesystem::IFileSystem::Unmount
virtual Result< void > Unmount(std::string_view path)=0
rex::filesystem::IFileSystem::Stat
virtual Result< FileStat > Stat(std::string_view path)=0
rex::filesystem::IFileSystem::Open
virtual Result< Opened > Open(std::string_view path, const OpenOptions &options)=0
rex::filesystem::IFile
Definition
file.h:27
directory.h
file_open.h
file_stat.h
file_system_error.h
file.h
host.h
mount.h
rex::filesystem::MountFlags
MountFlags
Definition
mount.h:38
rex::memory::Tag
Tag
Definition
host.h:22
rex::Result
std::expected< T, Error > Result
Definition
result.h:98
result.h
rex::filesystem::MountEntry
Definition
mount.h:43
rex::filesystem::OpenOptions
Definition
file_open.h:59
types.h
Integer types, byte order wrappers and size literals.
utility.h
Move only function, const propagating pointer and scope guard.
rex
filesystem
file_system.h
Generated by
1.18.0