pub struct AppState;Expand description
Zero-sized handle for the global launcher paths.
Implementations§
Source§impl AppState
impl AppState
Sourcepub fn init(name: impl Into<String>) -> AppStateResult<()>
pub fn init(name: impl Into<String>) -> AppStateResult<()>
Initialises the global launcher paths. Call once at startup.
name becomes the per-launcher subdirectory under the OS-
standard data/config/cache bases. Returns
AppStateError::AlreadyInitialized on a second call.
Sourcepub fn paths() -> &'static LauncherPaths
pub fn paths() -> &'static LauncherPaths
Returns the resolved launcher paths.
Panics with a clear message if Self::init hasn’t been
called — that’s a programmer error, not a runtime condition.
Sourcepub fn name() -> &'static str
pub fn name() -> &'static str
Launcher name as supplied to Self::init.
Sourcepub fn config_dir() -> &'static Path
pub fn config_dir() -> &'static Path
User configuration directory (the bundled JRE lives here).
Sourcepub fn app_version() -> &'static str
pub fn app_version() -> &'static str
Application version derived from CARGO_PKG_VERSION.
Sourcepub fn client_id() -> &'static str
pub fn client_id() -> &'static str
Per-install launcher client id, surfaced to the JVM as ${clientid}.
Persisted at <config_dir>/client_id so crash reports and Mojang
telemetry stay correlated across sessions. On first call we read it
from disk; on a missing/unreadable file we mint a fresh UUID v4
(RFC 4122) and write it back. Subsequent calls in the same process
hit the in-memory cache.