Skip to content

Commit f889124

Browse files
Merge pull request #5 from sudoriaa/main
fix&feat: 优化控制器获取正则表达式,使控制器更精确匹配”异环“游戏窗口。添加程序目录存在中文、半角符号检测,并在控制台输出警告
2 parents 5b6f57e + bea11e2 commit f889124

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

agent/main.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@
2525

2626
from utils import logger
2727

28+
# 路径兼容性检测 —— 最早执行,检测含中文/全角字符/中文符号的路径
29+
import re
30+
_cwd = os.getcwd()
31+
if re.search(r"[一-鿿 -〿＀-￯]", _cwd):
32+
logger.warning(
33+
f"当前运行目录含中文或全角字符: {_cwd}\n"
34+
"部分组件对此类路径兼容性较差,建议将程序移动至纯英文路径下运行。"
35+
)
36+
2837
VENV_NAME = ".venv" # 虚拟环境目录的名称
2938
VENV_DIR = Path(project_root_dir) / VENV_NAME
3039

@@ -398,17 +407,6 @@ def check_and_install_dependencies():
398407
# -----
399408

400409

401-
def _check_chinese_path():
402-
"""检测当前程序是否运行在含中文字符的目录下"""
403-
import re
404-
405-
cwd = os.getcwd()
406-
if re.search(r"[一-鿿]", cwd):
407-
logger.warning(
408-
f"当前运行目录含中文字符: {cwd}\n请将程序移动至纯英文路径下运行。"
409-
)
410-
411-
412410
def _check_admin_privilege():
413411
"""检查是否以管理员权限运行,若否则输出警告"""
414412
import ctypes

0 commit comments

Comments
 (0)