24 lines
510 B
Python
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()))
|