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.
OpenFileRequester: Add checking that file exists
OpenFileRequester: Add checking that file exists
The PureBASIC Archives:
- GitHub Repo + Wiki + Website
- https://tajmone.github.io/purebasic-archives
- PB Sourcecode Highlighters for Websites and Documents
- Dräc OOP Tutorial reprint
- Pandoc2BBCode: Post on PB Forums from Markdown, ReST, Docx, and other formats…
Re: OpenFileRequester: Add checking that file exists
+1 for an optional OpenFileRequester() flag
On Windows, I think this is as simple as adding the #OFN_FILEMUSTEXIST flag to an API call.
On Windows, I think this is as simple as adding the #OFN_FILEMUSTEXIST flag to an API call.
- marcoagpinto
- Addict
- Posts: 947
- Joined: Sun Mar 10, 2013 3:01 pm
- Location: Portugal
- Contact: