Files
lintunes/lintunes/config.py
T
trav f21c31940f
macOS / Tests (AppleSilicon) (push) Canceled after 0s
macOS / Tests (Intel) (push) Canceled after 0s
macOS / Build (AppleSilicon) (push) Canceled after 0s
macOS / Build (Intel) (push) Canceled after 0s
macOS / Publish the GitHub Release (push) Canceled after 0s
v0.97.0: macOS port (Round 129): OS-aware paths, config and cookies; Mac now-playing, packaging (PyInstaller .app, dmg build, signing notes, CI workflow) and docs
2026-11-17 22:41:48 -08:00

27 lines
588 B
Python

import json
from pathlib import Path
from lintunes import paths
def config_path() -> Path:
return paths.config_dir() / "config.json"
def load_config() -> dict:
path = config_path()
if path.exists():
try:
with open(path, "r", encoding="utf-8") as f:
return json.load(f)
except (ValueError, OSError):
pass
return {}
def save_config(config: dict):
path = config_path()
path.parent.mkdir(parents=True, exist_ok=True)
with open(path, "w", encoding="utf-8") as f:
json.dump(config, f, indent=2)