Skip to main content

config_home

Function config_home 

Source
pub fn config_home() -> Option<PathBuf>
Expand description

The XDG config base directory for lattice’s config root.

Resolves the XDG Base Directory config home so lattice’s config lives under ~/.config/lattice/ on every Unix — macOS included — instead of the platform-native ~/Library/Application Support that dirs::config_dir returns there. This matches the convention every developer CLI / editor uses (Helix, Neovim, Zed’s CLI, alacritty, starship, …): on macOS they read ~/.config/<app>, not ~/Library/Application Support/<app>.

Precedence (per the XDG Base Directory spec):

  1. $XDG_CONFIG_HOME when set to an absolute path — honoured on every platform so an explicit override always wins (a set-but-relative or empty value is spec-invalid and ignored).
  2. ~/.config on Unix (via $HOME).
  3. dirs::config_dir() elsewhere (Windows → %APPDATA%).

None only when neither the override nor the home directory resolves.