refactor: use VBA-Excel/VBA-Access as default output dirs by file type

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Misaka_Company
2026-05-11 10:01:37 +08:00
parent 8642d40032
commit 585a9ed7f3
2 changed files with 7 additions and 4 deletions

View File

@@ -76,8 +76,10 @@ class VBAExtractor:
elif VBA_OUTPUT_DIR is not None: elif VBA_OUTPUT_DIR is not None:
self.output_dir = Path(VBA_OUTPUT_DIR) self.output_dir = Path(VBA_OUTPUT_DIR)
else: else:
# 使用目标文件同目录下的VBA文件夹 # 根据文件类型使用不同的默认文件夹
self.output_dir = self.source_path.parent / "VBA" file_type = get_file_type(self.source_path)
default_dir = "VBA-Access" if file_type == 'access' else "VBA-Excel"
self.output_dir = self.source_path.parent / default_dir
# 创建输出目录结构 # 创建输出目录结构
self.modules_dir = self.output_dir / STANDARD_MODULE_DIR self.modules_dir = self.output_dir / STANDARD_MODULE_DIR

View File

@@ -472,8 +472,9 @@ def main():
if not vba_path.is_absolute(): if not vba_path.is_absolute():
vba_path = script_dir / vba_path vba_path = script_dir / vba_path
else: else:
# 使用目标文件同目录下的 VBA 文件夹 # 根据文件类型使用不同的默认文件夹
vba_path = target_path.parent / "VBA" default_dir = "VBA-Access" if file_type == "access" else "VBA-Excel"
vba_path = target_path.parent / default_dir
if not vba_path.exists(): if not vba_path.exists():
print(f"错误: VBA 代码目录不存在: {vba_path}") print(f"错误: VBA 代码目录不存在: {vba_path}")