Skip to content

Commit

Permalink
Opt: Show tips if MaaEmulator.MaaPath is not configured
Browse files Browse the repository at this point in the history
  • Loading branch information
LmeSzinc committed Mar 12, 2023
1 parent 3a12b9e commit 9e4bb4b
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion submodule/AlasMaaBridge/maa.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ def asst(self):
self.config.task_stop()

logger.info(f'MAA安装路径:{self.config.MaaEmulator_MaaPath}')
if not os.path.exists(self.config.MaaEmulator_MaaPath):
logger.critical(
f'未找到路径 {self.config.MaaEmulator_MaaPath},请确认MAA已安装在该路径。'
f'如果你是第一次使用MAA插件,需要自选安装MAA,并在 "MAA设置" - "MAA安装路径" 中填入MAA的安装路径')
raise RequestHumanTakeover
try:
incremental_path = [os.path.join(self.config.MaaEmulator_MaaPath, './cache')]
if self.config.MaaEmulator_PackageName in ["YoStarEN", "YoStarJP", "YoStarKR", "txwy"]:
Expand All @@ -63,7 +68,17 @@ def asst(self):
AssistantHandler.load(self.config.MaaEmulator_MaaPath, incremental_path)
except ModuleNotFoundError:
logger.critical('找不到MAA,请检查安装路径是否正确')
exit(1)
raise RequestHumanTakeover
except OSError as e:
# OSError: [WinError 126] 找不到指定的模块。
if '[WinError 126]' in str(e):
logger.exception(e)
logger.critical(
f'无法导入MAA,请确认MAA已正确安装在 {self.config.MaaEmulator_MaaPath}'
)
raise RequestHumanTakeover
else:
raise

@AssistantHandler.Asst.CallBackType
def callback(msg, details, arg):
Expand Down

0 comments on commit 9e4bb4b

Please sign in to comment.