27 template <StorageBackend Backend, ListfileProv
ider Listfile = NullListfile>
44 if (_project && resolved.
path && _project->exists(*resolved.
path))
return _project->read(*resolved.
path);
46 return _backend.readFile(resolved);
54 if (_project && resolved.
path && _project->exists(*resolved.
path))
return true;
55 return _backend.exists(resolved);
80 if (
auto written = _project->write(path, content); !written)
return std::unexpected(written.error());
85 if (
auto existing = _listfile.pathToFdid(path))
return *existing;
86 return _listfile.registerPath(path);
105 std::optional<ProjectDirectory> _project;
The owning byte buffer file contents are read into.
Result< FileDataID > addFile(std::string_view path, std::span< const std::byte > content)
Add (or overwrite) a file in the project directory.
bool exists(const FileKey &key)
Whether a file is reachable in the overlay or the storage.
Result< FileBuffer > readFile(const FileKey &key)
Read a file by key.
ClientFileSystem(Backend backend, Listfile listfile={}, std::optional< ProjectDirectory > project=std::nullopt)
Compose from ready components (backends are open by construction).
ProjectDirectory * project()
static constexpr StorageKind kind()
FileKey resolve(const FileKey &key) const
Fill the missing half of a key (path or FileDataID) from the listfile, best-effort.
A local directory acting as the ultimate patch: files here override every client archive,...
The error-handling vocabulary: ErrorCode, Error and the Result<T> alias every fallible wowlib operati...
File identity types: the strong FileDataID and the FileKey a read request travels as.
The pluggable listfile-provider contract and the no-database provider for clients that need none.
std::expected< T, Error > Result
Every fallible wowlib operation returns Result<T>; bindings translate the error branch into a target-...
std::unexpected< Error > makeError(ErrorCode code, std::string message, std::uint32_t nativeError=0)
Shorthand for constructing the error branch of a Result.
@ NotSupported
Operation not supported by this backend/provider.
@ Mpq
Pre-WoD retail clients (< 6.0), StormLib.
The project-directory overlay: a local directory acting as the ultimate patch over any client storage...
The storage-backend concept ClientFileSystem composes over.
std::optional< FileDataID > fdid
The numeric identifier, if known.
std::optional< std::string > path
The canonical client-internal path, if known.