I have an Electron app and I'm attempting to open a native file picker dialog and restrict the user to only selecting a single file with some custom extension (call it .foo).
On macOS (Mojave, if that matters), using Electron ^3.0.0, this:
dialog.showOpenDialog({ properties: ['openFile'], filters: [{name: 'Foo
Files', extensions: ['foo']}] })`
Will open a native file picker that only allows the user to select directories.
This:
dialog.showOpenDialog({ properties: ['openFile'], filters: [{extensions:
['foo']}] })
Will open a native file picker that allows me to pick a single file, but allows files with any extension to be selected.
How can I open a native file picker dialog on macOS that restricts the user to pick a single file with a specific extension?