From b6b2eeae6b337400305466767977fc127ae587ee Mon Sep 17 00:00:00 2001 From: PiEgg Date: Wed, 24 Aug 2022 10:00:00 +0800 Subject: [PATCH] :bug: Fix: showFileExplorer result bug --- src/main/apis/gui/index.ts | 2 +- src/universal/types/types.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/apis/gui/index.ts b/src/main/apis/gui/index.ts index 65e8117..341c488 100644 --- a/src/main/apis/gui/index.ts +++ b/src/main/apis/gui/index.ts @@ -69,7 +69,7 @@ class GuiApi implements IGuiApi { async showFileExplorer (options: IShowFileExplorerOption = {}) { this.windowId = await getWindowId() const res = await dialog.showOpenDialog(BrowserWindow.fromId(this.windowId)!, options) - return res.filePaths?.[0] + return res.filePaths || [] } async upload (input: IUploadOption) { diff --git a/src/universal/types/types.d.ts b/src/universal/types/types.d.ts index 905a83c..be72088 100644 --- a/src/universal/types/types.d.ts +++ b/src/universal/types/types.d.ts @@ -193,7 +193,7 @@ type IDispose = () => void // GuiApi interface IGuiApi { showInputBox: (options: IShowInputBoxOption) => Promise - showFileExplorer: (options: IShowFileExplorerOption) => Promise + showFileExplorer: (options: IShowFileExplorerOption) => Promise upload: (input: IUploadOption) => Promise showNotification: (options?: IShowNotificationOption) => void showMessageBox: (options?: IShowMessageBoxOption) => Promise