From c789a95e4e1f344f3b723df82cbce4c55d85227f Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Fri, 5 May 2023 17:37:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E7=9B=B4=E6=8E=A5=E5=8F=8C?= =?UTF-8?q?=E5=87=BB=E6=96=87=E4=BB=B6=E6=89=93=E5=BC=80=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E8=BF=9B=E5=85=A5=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/background.js | 4 ++-- web/src/electron/fileHandle.js | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/web/src/background.js b/web/src/background.js index 1db6f986..2b326a40 100644 --- a/web/src/background.js +++ b/web/src/background.js @@ -45,7 +45,7 @@ async function createMainWindow() { // 绑定事件 const bindEvent = () => { - bindFileHandleEvent({ mainWindow }) + bindFileHandleEvent({ mainWindow, initOpenFileQueue }) bindOtherHandleEvent() } @@ -76,7 +76,7 @@ app.on('will-finish-launching', () => { const argv = process.argv if (argv) { argv.forEach(filePath => { - if (filePath.indexOf('.apk') >= 0) { + if (filePath.indexOf('.smm') >= 0) { initOpenFileQueue.push(filePath) } }) diff --git a/web/src/electron/fileHandle.js b/web/src/electron/fileHandle.js index 69aa4020..aacbfaa9 100644 --- a/web/src/electron/fileHandle.js +++ b/web/src/electron/fileHandle.js @@ -11,7 +11,7 @@ import { } from './storage' import { v4 as uuid } from 'uuid' -export const bindFileHandleEvent = ({ mainWindow }) => { +export const bindFileHandleEvent = ({ mainWindow, initOpenFileQueue }) => { // 通知主页面刷新最近文件列表 const notifyMainWindowRefreshRecentFileList = () => { mainWindow.webContents.send('refreshRecentFileList') @@ -243,4 +243,9 @@ export const bindFileHandleEvent = ({ mainWindow }) => { }) }) }) + + // 直接双击文件打开应用时,需要直接打开该文件编辑 + initOpenFileQueue.forEach((file) => { + openFile(null, file) + }) }