diff --git a/electron/main.cjs b/electron/main.cjs index b7f377c..c53dfa5 100644 --- a/electron/main.cjs +++ b/electron/main.cjs @@ -708,9 +708,19 @@ ipcMain.handle('update-settings', (event, settings) => { return true }) -ipcMain.handle('pick-paths', async () => { - const result = await dialog.showOpenDialog(mainWindow, { +ipcMain.handle('pick-paths', async (event, options = {}) => { + const dialogOptions = { properties: ['openFile', 'multiSelections'], + } + if (Array.isArray(options?.filters) && options.filters.length > 0) { + dialogOptions.filters = options.filters + } + if (typeof options?.title === 'string' && options.title.trim()) { + dialogOptions.title = options.title.trim() + } + + const result = await dialog.showOpenDialog(mainWindow, { + ...dialogOptions, }) return result.canceled ? [] : result.filePaths }) diff --git a/electron/preload.cjs b/electron/preload.cjs index 3cfab5a..fe1981f 100644 --- a/electron/preload.cjs +++ b/electron/preload.cjs @@ -9,7 +9,7 @@ contextBridge.exposeInMainWorld('electronAPI', { getChangelogPage: (page) => ipcRenderer.invoke('get-changelog-page', page), setSetting: (key, value) => ipcRenderer.invoke('set-setting', key, value), updateSettings: (settings) => ipcRenderer.invoke('update-settings', settings), - pickPaths: () => ipcRenderer.invoke('pick-paths'), + pickPaths: (options) => ipcRenderer.invoke('pick-paths', options), openPath: (filePath) => ipcRenderer.invoke('open-path', filePath), openExternalLink: (event) => { event.preventDefault();