支持直接双击文件打开应用进入编辑

This commit is contained in:
wanglin2 2023-05-05 17:37:01 +08:00
parent b0532072c2
commit c789a95e4e
2 changed files with 8 additions and 3 deletions

View File

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

View File

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