From cf09e62034a8e35f12874227072c3a897b344f26 Mon Sep 17 00:00:00 2001 From: pompurin404 Date: Mon, 2 Sep 2024 15:01:46 +0800 Subject: [PATCH] fix windows runner --- src/main/index.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/index.ts b/src/main/index.ts index c4b3557..7b31b0b 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -14,7 +14,7 @@ import { initShortcut } from './resolve/shortcut' import { execSync } from 'child_process' import { createElevateTask } from './sys/misc' import { initProfileUpdater } from './core/profileUpdater' -import { writeFileSync } from 'fs' +import { existsSync, writeFileSync } from 'fs' import { taskDir } from './utils/dirs' import path from 'path' @@ -29,7 +29,11 @@ if (process.platform === 'win32' && !is.dev) { } else { writeFileSync(path.join(taskDir(), 'param.txt'), 'empty') } - execSync('schtasks /run /tn mihomo-party-run') + if (!existsSync(path.join(taskDir(), 'mihomo-party-run.exe'))) { + throw new Error('mihomo-party-run.exe not found') + } else { + execSync('schtasks /run /tn mihomo-party-run') + } } catch (e) { dialog.showErrorBox('首次启动请以管理员权限运行', '首次启动请以管理员权限运行') } finally {