13#include <unordered_map>
58 : _options(std::move(other._options)), _archives(std::move(other._archives)) {}
63 _options = std::move(other._options);
64 _archives = std::move(other._archives);
99 std::filesystem::path
path;
103 std::unique_ptr<std::mutex>
mtx;
114 std::unordered_map<std::string, std::filesystem::path>
loose;
118 std::span<const OpenedArchive>
archives()
const {
return _archives; }
127 : _options(std::move(options)) {}
135 void _close() noexcept;
138 bool _isOpen()
const {
return !_archives.empty(); }
141 std::vector<OpenedArchive> _archives;
The owning byte buffer file contents are read into.
bool exists(const FileKey &key)
Whether the file exists in any archive of the chain.
Result< std::vector< std::string > > enumeratePaths()
Enumerate every file path reachable through the chain: the members of each archive (named by its inte...
static constexpr StorageKind kind()
std::span< const OpenedArchive > archives() const
MpqStorage(MpqStorage &&other) noexcept
MpqStorage & operator=(MpqStorage &&other) noexcept
static Result< MpqStorage > open(Options options)
Expand the version's chain and open every archive present on disk.
MpqStorage & operator=(const MpqStorage &)=delete
Result< FileBuffer > readFile(const FileKey &key)
Read a file into memory.
MpqStorage(const MpqStorage &)=delete
Client version identity, the flavor axis that separates a client's CONTENT version from the engine ge...
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.
Per-version MPQ archive chain tables and their expansion against a real or fake Data/ directory.
std::expected< T, Error > Result
Every fallible wowlib operation returns Result<T>; bindings translate the error branch into a target-...
@ Mpq
Pre-WoD retail clients (< 6.0), StormLib.
One opened member of the chain, for introspection and tests.
std::unordered_map< std::string, std::filesystem::path > loose
Loose members: canonical in-game path -> the file on disk.
std::unique_ptr< std::mutex > mtx
Serializes StormLib calls (archive members).
void * handle
StormLib HANDLE (archive members).
bool isDirectory
true => served from loose files below.
bool patched
Whether wow-update patch archives are attached (Cata+).
std::filesystem::path path
The archive file or loose-dir root on disk.
Locale locale
The locale to open; its Data/{code}/ directory must exist on disk.
std::filesystem::path dataDir
The client's Data/ directory.
ClientVersion version
Selects the chain table.