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) + }) }