From 8c75631d4a9db1e9af93b74825f7002c9f5aa9c2 Mon Sep 17 00:00:00 2001 From: chenqiang Date: Wed, 10 Sep 2025 06:23:30 +0800 Subject: [PATCH] devtool --- background/main.js | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/background/main.js b/background/main.js index 016daf5..37252d1 100644 --- a/background/main.js +++ b/background/main.js @@ -62,20 +62,13 @@ async function createWindow() { // 然后显示窗口 mainWindow.show(); - // 添加:在便携模式下自动打开开发者工具 - // 检查是否为便携模式(检查可执行文件同级目录是否有portable.txt文件) + // 移除之前的便携模式检测逻辑,直接打开开发者工具 + // 这样在任何模式下都能查看控制台报错信息 try { - const exePath = app.getPath('exe'); - const appDir = path.dirname(exePath); - const portableFlagPath = path.join(appDir, 'portable.txt'); - - // 如果存在portable.txt文件,则为便携模式,打开开发者工具 - if (fs.existsSync(portableFlagPath)) { - console.log('检测到便携模式,打开开发者工具'); - mainWindow.webContents.openDevTools(); - } + console.log('打开开发者工具'); + mainWindow.webContents.openDevTools(); } catch (error) { - console.error('检查便携模式时出错:', error); + console.error('打开开发者工具时出错:', error); } // 添加窗口关闭事件监听