sqweek / dialog

Simple cross-platform dialog API for go-lang
ISC License
493 stars 76 forks source link

win32: directory browser can return no file and no error #12

Closed sqweek closed 6 years ago

sqweek commented 6 years ago

The directory browser on windows lets you choose certain shell folders such as "This PC" or attached MTP devices, which don't have an actual file system path.

The result is Browse() returns an empty string and no error, which I think is a surprising result. We should make sure to return a valid filename in the no error case.

sqweek commented 6 years ago

The OSX impl has an explicit error when the selected file is not representable (see cocoa/dlg.go:fileDlg), although I've never actually been able to trigger it. Having such an error on the public API may be a solution, although I think it's better if we can prevent invalid selections in the first place.

sqweek commented 6 years ago

Haha was about to go to bed, went to close my browser tab for BROWSEINFO then saw the BIF_RETURNONLYFSDIRS flag.