Open chanoc1 opened 2 years ago
A quick and dirty fix would be to switch over to dialog.showOpenDialogSync()
, which is basically the old behavior. (returns an array of strings representing file paths)
However, since it is a synchronous function, the rest of the program cannot be interacted with until a file has been chosen.
This is in direct contrast to the current behavior, where the user can still freely interact with the program, even with with the modal that opened the file browser closed. Perhaps this an oversight?
EDIT: Actually, upon further inspection, you can actually still click things when a dialog from dialog.showOpenDialogSync()
is open. It just won't update until you pick a file.
I prefer the synchronous behavior because this dialog is meant to be modal - it should block the user from interacting with the program while it's open.
fh.SelectDirectory()
andfh.selectFile
both calldialog.showOpenDialog()
expecting old behavior (expecting to get an array of strings representing file paths).However, since Electron 6.0.0,
dialog.showOpenDialog()
returns a Promise object.The code needs to be updated to reflect this, since the current code will always return
undefined
.Without this, any file picker dialogues opened won't actually work.