From c3117c9e363a0e65061db03c8ae85f4fe8500f4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B7=E4=B8=AA=E5=90=8D=E5=AD=97=E5=A5=BD=E9=9A=BE?= =?UTF-8?q?=E7=9A=84=E5=96=B5?= <25520958+MisakaAldrich@users.noreply.github.com> Date: Sat, 26 Jul 2025 22:47:32 +0800 Subject: [PATCH] fix validate --- build/pathing_authors.py | 6 +++++- build/validate.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/build/pathing_authors.py b/build/pathing_authors.py index bae19277..d06c65ff 100644 --- a/build/pathing_authors.py +++ b/build/pathing_authors.py @@ -1,7 +1,7 @@ import os import json -def process_json_authors(input_path, config_path="author_config.json", verbose=True): +def process_json_authors(input_path, verbose=True): """ 处理 JSON 文件中的作者信息(支持 author → authors 结构化迁移、作者名重命名和链接统一) @@ -19,6 +19,10 @@ def process_json_authors(input_path, config_path="author_config.json", verbose=T "errors": [] } + # 获取配置文件路径(和脚本在同一目录) + script_dir = os.path.dirname(os.path.abspath(__file__)) + config_path = os.path.join(script_dir, "author_config.json") + if not os.path.exists(input_path): raise FileNotFoundError(f"路径不存在:{input_path}") if not os.path.exists(config_path): diff --git a/build/validate.py b/build/validate.py index 2068da49..27f95b56 100755 --- a/build/validate.py +++ b/build/validate.py @@ -479,7 +479,7 @@ def scan_and_convert(path, target_extensions=None): # ==================== 验证修复作者信息 ==================== -def process_json_authors(input_path, config_path="author_config.json", verbose=False): +def process_json_authors(input_path, verbose=False): """ 处理 JSON 文件中的作者信息(支持 author → authors 结构化迁移、作者名重命名和链接统一) @@ -497,6 +497,10 @@ def process_json_authors(input_path, config_path="author_config.json", verbose=F "errors": [] } + # 获取配置文件路径(和脚本在同一目录) + script_dir = os.path.dirname(os.path.abspath(__file__)) + config_path = os.path.join(script_dir, "author_config.json") + if not os.path.exists(input_path): raise FileNotFoundError(f"路径不存在:{input_path}") if not os.path.exists(config_path):