From da37cb44aed9663bddc7e042cb7563af4c981602 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ACT=E4=B8=B6=E6=B5=81=E6=98=9F=E9=9B=A8?= <1340145680@qq.com> Date: Tue, 10 Feb 2026 19:56:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=99=BD=E5=B1=8F=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/main.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/scripts/main.ts b/scripts/main.ts index a1e2470..ff09072 100644 --- a/scripts/main.ts +++ b/scripts/main.ts @@ -3,21 +3,17 @@ import path from "path"; import startServe, { closeServe } from "src/app"; function createMainWindow(): void { - const isDev = process.env.NODE_ENV === "dev" || !app.isPackaged; - const basePath = isDev ? process.cwd() : app.getAppPath(); - const win = new BrowserWindow({ width: 900, height: 600, show: true, autoHideMenuBar: true, - icon: path.join( - basePath, - "scripts", - process.platform === "win32" ? "logo.ico" : "logo.png" - ), }); - const htmlPath = path.join(basePath, "scripts", "web", "index.html"); + // 开发环境和生产环境使用不同的路径 + const isDev = process.env.NODE_ENV === "dev" || !app.isPackaged; + const htmlPath = isDev + ? path.join(process.cwd(), "scripts", "web", "index.html") + : path.join(app.getAppPath(), "scripts", "web", "index.html"); void win.loadFile(htmlPath); } app.whenReady().then(async () => {