krypt_core/paths/mod.rs
1//! Path variable resolution.
2//!
3//! Translates `${VAR}` / `${env:VAR}` / `${env:VAR:-fallback}` expressions
4//! into concrete paths. Used to expand `dst` and other path-like fields in
5//! `.krypt.toml` once the platform + user overrides are known.
6//!
7//! See the [project README](https://github.com/kryptic-sh/krypt) for the
8//! full variable reference. Brief recap:
9//!
10//! | Var | Resolution |
11//! | -------------------- | ----------------------------------------- |
12//! | `${HOME}` | `$HOME` (Unix), `%USERPROFILE%` (Windows) |
13//! | `${XDG_CONFIG}` | `$XDG_CONFIG_HOME` or `${HOME}/.config` |
14//! | `${XDG_DATA}` | `$XDG_DATA_HOME` or `${HOME}/.local/share` |
15//! | `${XDG_STATE}` | `$XDG_STATE_HOME` or `${HOME}/.local/state` |
16//! | `${XDG_CACHE}` | `$XDG_CACHE_HOME` or `${HOME}/.cache` |
17//! | `${XDG_RUNTIME}` | `$XDG_RUNTIME_DIR` or platform fallback |
18//! | `${LOCAL_BIN}` | `${HOME}/.local/bin` |
19//! | `${DOCUMENTS}` | `${HOME}/Documents` |
20//! | `${WIN_LOCALAPPDATA}` | Windows only — errors elsewhere |
21//! | `${WIN_APPDATA}` | Windows only — errors elsewhere |
22//! | `${MAC_LIBRARY}` | macOS only — errors elsewhere |
23//! | `${env:VAR}` | Reads env var (empty if unset) |
24//! | `${env:VAR:-FB}` | Reads env var, falls back to FB if unset |
25//!
26//! User overrides live in the `[paths]` section of `.krypt.toml` and shadow
27//! built-in defaults. Override values may themselves contain `${...}`
28//! expressions, resolved recursively (with cycle detection).
29
30mod platform;
31mod resolve;
32
33pub use platform::Platform;
34pub use resolve::{ResolveError, Resolver};