cosmonaut-shell/transmitter-panel/paths.py

23 lines
770 B
Python

"""Shared filesystem locations. Works whether run from the repo or ~/.config."""
from __future__ import annotations
import os
from pathlib import Path
BASE_DIR = Path(__file__).resolve().parent
STYLE_DIR = BASE_DIR / "style"
# User settings live under XDG_STATE_HOME, NOT ~/.config — config-updater does
# `rm -rf ~/.config/transmitter-panel` on every dotfiles sync (see beacon/
# station-bar/astro-menu's own paths.py for the same rationale), which would
# wipe a hand-edited config on the spot.
STATE_DIR = Path(os.environ.get("XDG_STATE_HOME", Path.home() / ".local" / "state")) / "transmitter-panel"
CONFIG_FILE = STATE_DIR / "config.json"
APP_ID = "eu.abdelbaki.transmitterpanel"
def ensure_dirs() -> None:
STATE_DIR.mkdir(parents=True, exist_ok=True)