Expand description
XDG Base Directory paths for kaish and embedders.
This module provides two layers of path helpers:
-
XDG primitives — Generic XDG base directories that embedders can use to compose their own application-specific paths.
-
kaish-specific paths — Convenience functions for kaish’s own paths, built on top of the primitives.
§XDG Base Directory Specification
| Purpose | XDG Variable | Default |
|---|---|---|
| Runtime | $XDG_RUNTIME_DIR | /run/user/$UID or /tmp |
| Data | $XDG_DATA_HOME | ~/.local/share |
| Config | $XDG_CONFIG_HOME | ~/.config |
| Cache | $XDG_CACHE_HOME | ~/.cache |
§Example: Embedder Path Composition
use kaish_kernel::paths::{xdg_data_home, home_dir};
use std::path::PathBuf;
// Embedders compose their own paths on top of XDG primitives
fn my_app_data_dir() -> PathBuf {
xdg_data_home().join("myapp")
}
fn my_app_worktrees_dir() -> PathBuf {
my_app_data_dir().join("worktrees")
}Functions§
- cache_
dir - Get the kaish cache directory.
- config_
dir - Get the kaish config directory.
- data_
dir - Get the kaish data directory for persistent state.
- home_
dir - Get the user’s home directory.
- kernels_
dir - Get the kernels directory.
- runtime_
dir - Get the kaish runtime directory for sockets.
- spill_
dir - Get the spill directory for output truncation.
- xdg_
cache_ home - Get XDG cache home directory.
- xdg_
config_ home - Get XDG config home directory.
- xdg_
data_ home - Get XDG data home directory.
- xdg_
runtime_ dir - Get XDG runtime directory.