diff --git a/electron/main/item/index.ts b/electron/main/item/index.ts index 1078f62..0dab8ef 100644 --- a/electron/main/item/index.ts +++ b/electron/main/item/index.ts @@ -318,11 +318,15 @@ function execute( // 工作目录 let currentDir = startLocation; if (!currentDir || currentDir.trim() === "") { - let statRes = statSync(file); - if (statRes.isDirectory()) { - currentDir = file; - } else { - currentDir = dirname(file); + try { + let statRes = statSync(file); + if (statRes.isDirectory()) { + currentDir = file; + } else { + currentDir = dirname(file); + } + } catch (e) { + currentDir = app.getPath("home"); } } // 组装命令