runtime.py 427 B

1234567891011121314151617
  1. import os as _os
  2. runtime_dir = _os.path.realpath(_os.path.join(__file__,'..','..','runtime'))
  3. config_file = _os.path.join(runtime_dir, "config.json")
  4. def load_config():
  5. import json
  6. if _os.path.isfile(config_file):
  7. with open(config_file) as fd:
  8. return json.load(fd)
  9. else:
  10. return {}
  11. def save_config():
  12. import json
  13. with open(config_file, "w") as fd:
  14. return json.dump(fd)