Files
virtual-controller/presets.py
T
Paul Lipscomb 3e2147fa02 initial commit
2026-06-16 22:37:38 -04:00

17 lines
531 B
Python

import json
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
PRESETS_DIR = os.path.join(BASE_DIR, "presets")
PRESETS_FILE = os.path.join(PRESETS_DIR, "presets.json")
os.makedirs(PRESETS_DIR, exist_ok=True)
def load_presets_file():
if os.path.exists(PRESETS_FILE):
with open(PRESETS_FILE, "r") as f:
return json.load(f)
return {"__last_used__": None, "presets": {}}
def save_presets_file(data):
with open(PRESETS_FILE, "w") as f:
json.dump(data, f, indent=2)