Skip to content

Commit

Permalink
chore: 修正目录名参数命名
Browse files Browse the repository at this point in the history
  • Loading branch information
weiduhuo committed Nov 24, 2023
1 parent 0c2b779 commit 58e1ead
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions utils/relic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 58e1ead

Please sign in to comment.