From 58e1ead3be7e42547f096e032e63b0eba2b2b29a Mon Sep 17 00:00:00 2001 From: Weiduhuo <1281586535@qq.com> Date: Fri, 24 Nov 2023 11:28:44 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BF=AE=E6=AD=A3=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E5=90=8D=E5=8F=82=E6=95=B0=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/config.py | 18 +++++++++--------- utils/relic.py | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/utils/config.py b/utils/config.py index 86a40197..668637de 100644 --- a/utils/config.py +++ b/utils/config.py @@ -14,15 +14,15 @@ CONFIG_FILE_NAME = "config.json" -USER_DATA_PREFIX = "data/user_data/" -FIXED_DATA_PREFIX = "data/fixed_data/" -os.makedirs(USER_DATA_PREFIX, exist_ok=True) +USER_DATA_DIR = "data/user_data/" +FIXED_DATA_DIR = "data/fixed_data/" +os.makedirs(USER_DATA_DIR, exist_ok=True) -RELIC_FILE_NAME = USER_DATA_PREFIX + "relics_set.json" -LOADOUT_FILE_NAME = USER_DATA_PREFIX + "relics_loadout.json" -TEAM_FILE_NAME = USER_DATA_PREFIX + "relics_team.json" -CHAR_PANEL_FILE_NAME = USER_DATA_PREFIX + "char_panel.json" -CHAR_WEIGHT_FILE_NAME = USER_DATA_PREFIX + "char_weight.json" +RELIC_FILE_NAME = USER_DATA_DIR + "relics_set.json" +LOADOUT_FILE_NAME = USER_DATA_DIR + "relics_loadout.json" +TEAM_FILE_NAME = USER_DATA_DIR + "relics_team.json" +CHAR_PANEL_FILE_NAME = USER_DATA_DIR + "char_panel.json" +CHAR_WEIGHT_FILE_NAME = USER_DATA_DIR + "char_weight.json" def normalize_file_path(filename): @@ -41,7 +41,7 @@ def normalize_file_path(filename): pre_filename = str(filename).rsplit('/', 1)[-1] file_path = os.path.join(current_dir, pre_filename) if os.path.exists(file_path): - if str(filename).rsplit('/', 1)[0] == USER_DATA_PREFIX[:-1]: + if str(filename).rsplit('/', 1)[0] == USER_DATA_DIR[:-1]: # 判断为旧版本 (<=1.8.7) 数据文件位置 import shutil shutil.move(file_path, pre_file_path) diff --git a/utils/relic.py b/utils/relic.py index d69c7a85..47e719e1 100644 --- a/utils/relic.py +++ b/utils/relic.py @@ -14,7 +14,7 @@ from .relic_constants import * from .calculated import (calculated, Array2dict, StyledText, FloatValidator, ConflictValidator, get_data_hash, str_just, print_styled_text, combine_styled_text) -from .config import (RELIC_FILE_NAME, LOADOUT_FILE_NAME, TEAM_FILE_NAME, CHAR_PANEL_FILE_NAME, CHAR_WEIGHT_FILE_NAME, USER_DATA_PREFIX, +from .config import (RELIC_FILE_NAME, LOADOUT_FILE_NAME, TEAM_FILE_NAME, CHAR_PANEL_FILE_NAME, CHAR_WEIGHT_FILE_NAME, USER_DATA_DIR, read_json_file, modify_json_file, rewrite_json_file, _, sra_config_obj) from .exceptions import Exception, RelicOCRException from .log import log @@ -303,7 +303,7 @@ def batch_ocr_relics(self, stats_weight: StatsWeight=StatsWeight(), weight_name: log.info(_("共写入 {} 件新遗器至'{}'文件").format(cnt, RELIC_FILE_NAME)) elif option_3 == 2: from datetime import datetime - file_name = "{}relics_set_{}.json".format(USER_DATA_PREFIX, str(int(datetime.timestamp(datetime.now())))) + file_name = "{}relics_set_{}.json".format(USER_DATA_DIR, str(int(datetime.timestamp(datetime.now())))) rewrite_json_file(file_name, relics_data) log.info(_("共写入 {} 件遗器至'{}'文件").format(len(relics_data), file_name)) return self.batch_ocr_relics(stats_weight, weight_name)