okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
236cca71b
main
1"""Per-user state locations, one rule for the terminal and the host. 2 3POSIX keeps $XDG_STATE_HOME (default ~/.local/state) under ``strata/``. Windows has no such place: state goes to 4``%LOCALAPPDATA%\\Strata``. The Node host (apps/host/server/platform-paths.mjs) resolves the same folders. 5""" 6 7from __future__import annotations 8 9import os 10from pathlib import Path 11 12 13def state_base (environ = None ,* ,windows :bool | None = None ,home :Path | None = None )-> Path : 14"""The folder that holds Strata's per-user state: runtime/, tuning/, time-skip/.""" 15environ = os .environ if environ is None else environ 16windows = os .name == "nt" if windows is None else windows 17home = Path .home ()if home is None else home 18if windows : 19local = environ .get ("LOCALAPPDATA" )or str (home / "AppData" / "Local" ) 20return Path (local )/ "Strata" 21return Path (environ .get ("XDG_STATE_HOME" )or str (home / ".local" / "state" ))/ "strata"