20 lines
405 B
Python
20 lines
405 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:
|
|
zkac_home().mkdir(parents=True, exist_ok=True)
|
|
d = user_dir(userid)
|
|
d.mkdir(parents=True, exist_ok=True)
|
|
return d
|