fist config json file

This commit is contained in:
bluepulsar
2025-12-25 12:28:19 +08:00
parent a62f3aa283
commit 64f07fdfb9
2 changed files with 37 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
import json
from pathlib import Path
CONFIG_DIR = Path(__file__).parent
def load_config(config_name: str):
config_path = CONFIG_DIR / f"{config_name}.json"
with open(config_path, 'r') as f:
return json.load(f)
def save_config(config: dict, config_name: str):
config_path = CONFIG_DIR / f"{config_name}.json"
with open(config_path, 'w') as f:
json.dump(config, f, indent=4)