OpenFileRequester: Add checking that file exists

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Tristano
Enthusiast
Enthusiast
Posts: 190
Joined: Thu Nov 26, 2015 6:52 pm
Location: Italy
Contact:

OpenFileRequester: Add checking that file exists

Post 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.
The PureBASIC Archives: FOSS Resources:
User avatar
kenmo
Addict
Addict
Posts: 1967
Joined: Tue Dec 23, 2003 3:54 am

Re: OpenFileRequester: Add checking that file exists

Post 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.
User avatar
marcoagpinto
Addict
Addict
Posts: 947
Joined: Sun Mar 10, 2013 3:01 pm
Location: Portugal
Contact:

Re: OpenFileRequester: Add checking that file exists

Post by marcoagpinto »

+1
Post Reply