winbrew_core/env.rs
1//! Shared environment variable names used by Winbrew's path and config resolution.
2//!
3//! These constants define the public environment-variable names that higher-level
4//! configuration code reads before it resolves the final application paths.
5//! They are stable strings that external scripts, tests, and administrators can
6//! rely on when overriding Winbrew's defaults.
7//!
8//! # Platform Notes
9//!
10//! `LOCALAPPDATA` is a Windows-specific convention. Winbrew exports the name so
11//! the default Windows application root can be derived consistently.
12//!
13//! # Security Considerations
14//!
15//! These values are read from the process environment via `std::env::var`.
16//! Treat them as untrusted input until the caller validates or normalizes the
17//! resulting path.
18
19#[doc(alias = "appdata")]
20#[doc(alias = "local appdata")]
21/// Standard Windows environment variable that points to the user's Local AppData directory.
22///
23/// Winbrew uses this as the base directory for the default application root when
24/// `WINBREW_PATHS_ROOT` is not set. The resolved path typically follows:
25/// `%LOCALAPPDATA%\winbrew`.
26pub const LOCALAPPDATA: &str = "LOCALAPPDATA";
27
28#[doc(alias = "root")]
29#[doc(alias = "install_dir")]
30#[doc(alias = "paths.root")]
31/// Winbrew-specific environment variable that overrides the configured `paths.root` value.
32///
33/// When set, this bypasses the persisted `paths.root` setting and the default
34/// `LOCALAPPDATA`-based root. Tests, CI jobs, and portable runs can point Winbrew
35/// at an alternate root directory without changing user configuration.
36pub const WINBREW_PATHS_ROOT: &str = "WINBREW_PATHS_ROOT";