Dialog APIs


How to select directory path with the dialog APIs?


It’s not clear to me what exactly you are asking about. If you only want the user to be able to select directories from the open dialog you can use the properties option:

dialog.showOpenDialog({ properties: ['openDirectory'] }, cb)

If you want to set the path the dialog opens at you can use the defaultPath option:

dialog.showOpenDialog({ defaultPath: '/tmp' }, cb)

If none of that is what you want try the dialog module documentation.


The first option is exactly what I was looking for. Thank you John! I tried to figure out how to accomplish this with showSaveDialog that does not work on windows but works on OSX.
Thanks a lot!