Files
seagull-game/app/pylocal/desktop.py
Nicole O'Connor 0bd2f4827b state sync, many changes:
* separated css/js/rule files to pak file (glorified zip) to reduce full rebuilds
* implemented build cache
* some frontend UI spiffing up
2025-09-02 16:44:28 -07:00

35 lines
983 B
Python

import pathlib
from . import core
path_storagedir = pathlib.Path()
class JS_API:
debug_mode = False
def __init__(self, debug_mode=False):
self.debug_mode = debug_mode
def load_data(self, key):
if not (path_storagedir / key).exists():
return None
with open(path_storagedir / key) as fd_datafile:
try:
return fd_datafile.read()
except Exception as exc:
core.log.error(f"problem loading {key} (from {path_storagedir}): {exc}")
return None
def save_data(self, key, data):
with open(path_storagedir / key, "w") as fd_datafile:
try:
fd_datafile.write(data)
except Exception as exc:
core.log.error(f"problem saving {key} (to {path_storagedir}): {exc}")
def delete_data(self, key):
if (path_storagedir / key).exists():
(path_storagedir / key).unlink()
api = JS_API()