|
@@ -10,7 +10,7 @@ const fs: typeof import("fs") = isElectron() && window.nodeRequire("fs");
|
|
|
|
|
|
/** 执行本地exe文件 */
|
|
|
export function execLocal(exeName: string): Promise<void> {
|
|
|
- if (isElectron()) {
|
|
|
+ if (!isElectron()) {
|
|
|
logger({
|
|
|
pgu: "AUTO",
|
|
|
cnl: ["local", "server"],
|
|
@@ -18,6 +18,9 @@ export function execLocal(exeName: string): Promise<void> {
|
|
|
});
|
|
|
throw new Error("不在Electron中,调用 fs 失败");
|
|
|
}
|
|
|
+ if (import.meta.env.DEV) {
|
|
|
+ return Promise.resolve();
|
|
|
+ }
|
|
|
return new Promise<void>((resolve) => {
|
|
|
// eslint-disable-next-line
|
|
|
window
|
|
@@ -71,7 +74,7 @@ export function execLocal(exeName: string): Promise<void> {
|
|
|
|
|
|
/** 文件路径是否存在 */
|
|
|
export function fileExists(file: string): boolean {
|
|
|
- if (typeof window.nodeRequire == "undefined") {
|
|
|
+ if (!isElectron()) {
|
|
|
logger({
|
|
|
pgu: "AUTO",
|
|
|
cnl: ["local", "server"],
|