From 23f551fe183ae1bde846093520aed9dd1d4c8f44 Mon Sep 17 00:00:00 2001 From: EightyDollars Date: Wed, 4 Dec 2024 19:05:49 +0800 Subject: [PATCH] =?UTF-8?q?conf=E4=BD=BF=E7=94=A8json=E5=AD=98=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- launcher/config/__init__.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/launcher/config/__init__.py b/launcher/config/__init__.py index c2dbc6e..b36e8f2 100644 --- a/launcher/config/__init__.py +++ b/launcher/config/__init__.py @@ -1,25 +1,26 @@ +import json import os import yaml from yamlcore import CoreDumper, CoreLoader from launcher.config.conf import Conf -from python.Lib.pathlib import Path +from pathlib import Path -conf_path = Path(os.path.join(os.getcwd(), "conf.yml")) +conf_path = Path(os.path.join(os.getcwd(), "conf.json")) def save_conf(): with conf_path.open("w", encoding="utf8") as f: - # json.dump(conf.model_dump(), f, ensure_ascii=False, indent=4) # Use json.dump - yaml.dump( - conf.model_dump(), - f, - Dumper=CoreDumper, - encoding="utf-8", - default_flow_style=False, - allow_unicode=True, - ) + json.dump(conf.model_dump(), f, ensure_ascii=False, indent=4) # Use json.dump + # yaml.dump( + # conf.model_dump(), + # f, + # Dumper=CoreDumper, + # encoding="utf-8", + # default_flow_style=False, + # allow_unicode=True, + # ) def load_conf():