wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
Loading...
Searching...
No Matches
client_install.hpp
Go to the documentation of this file.
1#pragma once
2
6
7#include <filesystem>
8#include <string>
9
10#include <welder/vocabulary.hpp>
11
13#include <wowlib/core/error.hpp>
14
15namespace wowlib::fs {
16 struct [[
17 =welder::weld,
18 =welder::doc(R"(
19 What a client installation says about itself: the exact version, the
20 flavor that follows from its product code, and the TACT product code
21 itself.
22
23 Detecting beats hand-writing a ClientVersion for anything Classic. Those
24 products ship new builds continuously and the build — not the 1.15 / 4.4
25 version number — decides which engine's file formats the install
26 carries, so the build has to be right. detect() reads it from the files
27 Blizzard's installer leaves behind.
28
29 Examples:
30 ```python
31 from wowlib.fs import ClientInstall, FileSystem, FileSystemSettings
32
33 install = ClientInstall.detect("/Games/World of Warcraft/_classic_era_")
34 print(install.version) # 1.15.9.69109 (ClassicEra)
35 print(install.casc_product) # 'wow_classic_era'
36
37 settings = FileSystemSettings(install.path, install.version,
38 casc_product=install.casc_product)
39 with FileSystem.open(settings) as fs:
40 ...
41 ```)")
42 ]] ClientInstall {
43 [[=welder::doc("The installation directory that was inspected — the one "
44 "holding Data/, ready to hand to FileSystemSettings.")]]
45 std::filesystem::path path;
46
47 [[=welder::doc("The exact installed version, flavor included.")]]
49
50 [[=welder::doc("The exact TACT product code the installation records "
51 "('wow', 'wow_classic_era', 'wow_classic_ptr', ...) — which "
52 "can be more specific than the flavor's default.")]]
53 std::string cascProduct;
54
55 [[=welder::doc(R"(
56 Read a client installation's identity from the files its installer
57 leaves behind: .flavor.info (the product code) beside Data/, and
58 .build.info (the version table) there or one directory up, where a
59 multi-flavor install keeps it.
60
61 Only works for CASC installations. MPQ-era clients (< 6.0) record no
62 such thing, and neither do repacks that ship only Data/ — construct
63 their ClientVersion directly, which is unambiguous anyway since those
64 versions are not shared with any Classic product.)"),
65 =welder::returns("the detected installation, or NotSupported when the "
66 "directory carries no CASC build information")]]
68 std::filesystem::path clientPath [[=welder::doc("the installation directory holding Data/")]]);
69 };
70}
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...
std::expected< T, Error > Result
Every fallible wowlib operation returns Result<T>; bindings translate the error branch into a target-...
Definition error.hpp:100
std::string cascProduct
The exact TACT product code the installation records ('wow', 'wow_classic_era', 'wow_classic_ptr',...
static Result< ClientInstall > detect(std::filesystem::path clientPath)
ClientVersion version
The exact installed version, flavor included.
std::filesystem::path path
The installation directory that was inspected — the one holding Data/, ready to hand to FileSystemSet...