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):