ZKAC/cli/zkac_cli/paths.py
everbarry 6e67836e95 v0.4
2026-04-18 01:06:12 +02:00

24 lines
510 B
Python

from __future__ import annotations
import os
from pathlib import Path
def zkac_home() -> Path:
return Path(os.environ.get("ZKAC_HOME", Path.home() / ".zkac"))
def user_dir(userid: str) -> Path:
return zkac_home() / userid
def ensure_user(userid: str) -> Path:
d = user_dir(userid)
d.mkdir(parents=True, exist_ok=True)
return d
def data_dir() -> Path:
"""Default server data root (overridable via ZKAC_DATA_DIR)."""
return Path(os.environ.get("ZKAC_DATA_DIR", zkac_home()))