🐛 Fix: showFileExplorer result bug

This commit is contained in:
PiEgg 2022-08-24 10:00:00 +08:00
parent 5f1fb08368
commit b6b2eeae6b
2 changed files with 2 additions and 2 deletions

View File

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

View File

@ -193,7 +193,7 @@ type IDispose = () => void
// GuiApi
interface IGuiApi {
showInputBox: (options: IShowInputBoxOption) => Promise<string>
showFileExplorer: (options: IShowFileExplorerOption) => Promise<string>
showFileExplorer: (options: IShowFileExplorerOption) => Promise<string[]>
upload: (input: IUploadOption) => Promise<ImgInfo[]>
showNotification: (options?: IShowNotificationOption) => void
showMessageBox: (options?: IShowMessageBoxOption) => Promise<IShowMessageBoxResult>