fix: 修复输出路径问题 — 路径解析改为基于应用目录而非CWD

当从外部目录(如D:\ccc)拖入文件时,输出文件会错误地写入源目录。
根因是所有路径使用相对路径 + os.getcwd() 解析,CWD不同则路径错误。

修复方案:
- ConfigManager.get_path() 改为使用 app_root (exe所在目录/脚本所在目录)
- 将 22 处裸硬编码 "data/result"/"data/output" 替换为 config.get_path()
- 添加 result_folder 到默认配置和 config.ini
- 修复 error_utils.py 中的路径匹配字符串

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-04 23:05:10 +08:00
parent 6fd14b4e49
commit 6f96bf50ac
18 changed files with 84 additions and 271 deletions
+2 -2
View File
@@ -34,8 +34,8 @@ def get_error_suggestion(message: str) -> Optional[str]:
return '降低识别频率或稍后重试'
if '模板文件不存在' in msg or ('no such file' in msg and '模板' in msg):
return '在系统设置中选择正确的模板文件路径'
if '没有找到采购单' in msg or '未在 data/result 目录下找到采购单' in msg:
return '确认data/result目录内存在采购单文件'
if '没有找到采购单' in msg or '未在' in msg and '找到采购单' in msg:
return '确认result目录内存在采购单文件'
if 'permission denied' in msg:
return '以管理员权限运行或更改目录写入权限'
return None