Page 1 of 1

OpenFileRequester: Add checking that file exists

Posted: Wed Apr 26, 2017 9:42 am
by Tristano
Currently, OpenFileRequester() doesn't carry out any sanity checks. The end user can manually type the name of a non-existing file.

So it falls back on the programmer to check that the actual filename returned exisists.

Since the purpose of this requester is to allow the user to choose a file (ie: an existing file) it would make sense that this command checks that the string of the selections corresponds to an actually existing file.

It should still accept an empty string as a cancel operation, but it might make sense that if the string doesn't match an existing file name the requester doesn't close --- ie: the user has to either chose an existing file or cancel the operation, no compromises.

This would spare programmers from having to implement sanity checks on the user choice.

Re: OpenFileRequester: Add checking that file exists

Posted: Thu Apr 27, 2017 2:56 pm
by kenmo
+1 for an optional OpenFileRequester() flag

On Windows, I think this is as simple as adding the #OFN_FILEMUSTEXIST flag to an API call.

Re: OpenFileRequester: Add checking that file exists

Posted: Thu Apr 27, 2017 3:23 pm
by marcoagpinto
+1