Skip to main content

Module paths

Module paths 

Source
Expand description

XDG Base Directory paths for kaish and embedders.

This module provides two layers of path helpers:

  1. XDG primitives — Generic XDG base directories that embedders can use to compose their own application-specific paths.

  2. kaish-specific paths — Convenience functions for kaish’s own paths, built on top of the primitives.

§XDG Base Directory Specification

PurposeXDG VariableDefault
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.
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.