fix mpv path save dialog (#930) (#940)

This commit is contained in:
jeffvli 2025-06-02 20:17:55 -07:00
parent 6b91ee4a25
commit 7562c619d2
3 changed files with 35 additions and 10 deletions

View file

@ -1,6 +1,6 @@
import type { TitleTheme } from '/@/shared/types/types';
import { ipcMain, nativeTheme, safeStorage } from 'electron';
import { dialog, ipcMain, nativeTheme, OpenDialogOptions, safeStorage } from 'electron';
import Store from 'electron-store';
export const store = new Store();
@ -55,3 +55,12 @@ ipcMain.on('theme-set', (_event, theme: TitleTheme) => {
store.set('theme', theme);
nativeTheme.themeSource = theme;
});
ipcMain.handle('open-file-selector', async (_event, options: OpenDialogOptions) => {
const result = await dialog.showOpenDialog({
...options,
properties: ['openFile'],
});
return result.filePaths[0] || null;
});