fixed an issue that caused the program to crash if the item did not exist when opening the item.

This commit is contained in:
unknown 2024-04-11 19:36:37 +08:00
parent d117397dc3
commit e7ce285ae9

View File

@ -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");
}
}
// 组装命令