91e75e620b
CI: cua-driver distro-compat matrix / debian:12 (glibc 2.36) (push) Has been cancelled
CI: SPDX Headers / Check SPDX headers (warn-only) (push) Has been cancelled
CD: Docs MCP Server / build (linux/amd64) (push) Has been cancelled
CD: Docs MCP Server / build (linux/arm64) (push) Has been cancelled
CD: Docs MCP Server / merge (push) Has been cancelled
CI: cua-driver distro-compat matrix / Resolve release version (push) Has been cancelled
CI: cua-driver distro-compat matrix / fedora:41 (glibc 2.40) (push) Has been cancelled
CI: cua-driver distro-compat matrix / rockylinux:9 (glibc 2.34) (push) Has been cancelled
CI: cua-driver distro-compat matrix / ubuntu:22.04 (glibc 2.35) (push) Has been cancelled
CI: cua-driver distro-compat matrix / ubuntu:24.04 (glibc 2.39) (push) Has been cancelled
CI: cua-driver distro-compat matrix / Distro compat summary (push) Has been cancelled
CI: Rust Linux unit / Rust Linux unit and compile (push) Has been cancelled
CI: Rust Windows unit / Rust Windows unit and compile (push) Has been cancelled
CI: Nix Linux Rust source / Nix / compositor build (push) Has been cancelled
CI: Nix Linux Rust source / Nix / driver package (push) Has been cancelled
CI: Nix Linux Rust source / Nix / Rust unit tests (push) Has been cancelled
31 lines
817 B
Python
31 lines
817 B
Python
"""XDG Base Directory helpers for CUA CLI."""
|
|
|
|
import os
|
|
from pathlib import Path
|
|
|
|
|
|
def get_xdg_data_home() -> Path:
|
|
"""Get XDG_DATA_HOME, defaulting to ~/.local/share per spec."""
|
|
xdg_data = os.environ.get("XDG_DATA_HOME")
|
|
if xdg_data:
|
|
return Path(xdg_data)
|
|
return Path.home() / ".local" / "share"
|
|
|
|
|
|
def get_xdg_state_home() -> Path:
|
|
"""Get XDG_STATE_HOME, defaulting to ~/.local/state per spec."""
|
|
xdg_state = os.environ.get("XDG_STATE_HOME")
|
|
if xdg_state:
|
|
return Path(xdg_state)
|
|
return Path.home() / ".local" / "state"
|
|
|
|
|
|
def get_data_dir() -> Path:
|
|
"""Get the CUA data directory (for images)."""
|
|
return get_xdg_data_home() / "cua"
|
|
|
|
|
|
def get_state_dir() -> Path:
|
|
"""Get the CUA state directory (for registries)."""
|
|
return get_xdg_state_home() / "cua"
|