Expand description
Where things live: $HOME, $CARGO_HOME, and the shared cache root.
Everything epicenter touches derives from two roots:
- Cargo’s home (
$CARGO_HOMEor~/.cargo): globalconfig.toml, the already-shared source registry — and the shared build cache. - epicenter’s own dir (
~/.epicenter): reserved for epicenter files.
The default cache path is expressed ONCE as a cargo template
({cargo-cache-home}/epicenter/build): cargo expands it at build time,
and resolve_template expands it identically for epicenter’s own file
operations — so the two mechanisms can never drift apart. Same story on
WSL (ext4) and native Windows (NTFS).
Constants§
- DEFAULT_
BUILD_ DIR - The shared-build-dir template, as written into Cargo’s global config —
THE canonical value, identical on every OS, written with FORWARD slashes:
it is the one form verified to work on Linux (backslash variants expand
into paths whose separators cargo treats inconsistently on Linux — the
artifacts never materialize on disk, basename-level
listdirproves it) and forward slashes are legal path separators on Windows, too. Never write an expanded path into a config file: cargo expands{cargo-cache-home}itself at every build, per platform.
Functions§
- cargo_
home - Cargo’s home dir:
$CARGO_HOME, or~/.cargo. Holds the globalconfig.toml, the already-shared source cache (registry/) — and, and the shared build cache. - cargo_
metadata_ build_ dir - Ask cargo for its
build_directory(Nonewhen cargo metadata fails, e.g. when not inside any Cargo workspace). - cargo_
resolved_ build_ dir - The directory cargo actually uses for the shared build cache — resolved from cargo itself, at runtime.
- default_
cache_ root - The canonical build-dir template, exactly as it is written into cargo’s
config. This is not a filesystem path; commands that touch files use
cargo_resolved_build_dir. - epicenter_
dir - epicenter’s (former) own directory — only kept for the doctor’s
legacy-file advisory; the shared-cache decision lives in
~/.cargo/config.tomlnow. - home
- The user’s home directory (
$HOME, with a portable fallback). - normalize_
host_ separators - Template-literal backslashes -> host separator (see
cargo_resolved_build_dir). - resolve_
template - Expand a cargo-style build-dir template value into a concrete path — for epicenter’s local file operations only (never for writing configs).