-
Notifications
You must be signed in to change notification settings - Fork 3
Description
(Follow up to these comments)
The spec for glk_stream_open_file currently says:
If the filemode requires the file to exist, but the file does not exist, glk_stream_open_file() returns NULL.
But many Glk libraries will actually issue a fatal error. The spec should be edited to say that the file must exist instead. Possibly there could be a comment saying that interpreters can keep their current lax behaviour, but that game authors must ensure the file exists. (Edit 29 Oct 2017, I don't think this would really be all that helpful - lax IDE implementations is a big cause of problems.)
Now the Inform 7 template function RESTORE_THE_GAME_R doesn't check for existence before trying to open a stream. The spec says this for glk_fileref_create_by_prompt:
filemode_Read: The file must already exist; the player will be asked to select from existing files which match the usage.
I had interpreted this as more of a hint to the library/player - particularly with GUIs that the library is to present the player with a list of files. But perhaps it was intended to be more determinative.
The spec for glk_fileref_create_by_prompt could be clarified to say that libraries must validate that the file entered by the player does actually exist if the mode is filemode_Read, or else the library must return NULL, even though the player did select something. I think this would keep the code pattern followed by Inform etc working.