Open folder with showOpenDialog, but only if it contains a specific file


You can use FileFilter in showOpenDialog to limit what filetypes the user can open.

For example, if I only want users to open a file with the name ‘myfile.txt’ I can use the following filter:

filters:[{name: ‘myfile’, extensions: [‘txt’]

This works, which is great.

However, in my situation I would also like a user to be able to open a directory that contains a ‘myfile.txt’ file.

Does anyone know if that’s possible? Or should I not look any further and force people to open the file itself instead of the parent directory?