UmberHubManager/fiwi/paths.py

23 lines
558 B
Python

"""Runtime directory for JSON maps and Fi-Wi SSH dotenv files (e.g. remote_ssh.env)."""
import os
from typing import Optional
_BASE: Optional[str] = None
def configure(app_dir: str) -> None:
"""Call once from ``fiwi.py`` with ``dirname(abspath(__file__))``."""
global _BASE
_BASE = os.path.abspath(app_dir)
def base_dir() -> str:
if _BASE is None:
raise RuntimeError("fiwi.paths.configure() was not called (run via fiwi.py)")
return _BASE
def fiber_map_path() -> str:
return os.path.join(base_dir(), "fiber_map.json")