The Glk port, to provide graphics and sound, writes out individual PIC and SND files, as suggested by the Blorb specification, and supported by Gargoyle (and xglk should at least support PIC files).
However, it also uses Glk to open these files, but Glk doesn't provide the ability to open arbitrary files. It used to work with Gargoyle, but when I synced Gargoyle with the latest cheapglk, things broke: this is because cheapglk, as recommended by the Glk spec, adds extensions to all files opened by it. Specifically for data files, .glkdata
is added, meaning files are called something like PIC0.glkdata
. As such these files no longer have valid names for Gargoyle (or any other implementation which uses the suggested names).
I've got a hacky solution in a pull request: garglk/garglk#649. Part of the issue is that it requires the non-standard glkunix_stream_open_pathname
function to directly open a file. This is part of the glkunix startup, not Glk itself. Since this repo is called hugo-unix, that may not matter, but it's worth pointing out. The function does exist in cheapglk, xglk, glkterm, remglk, and Gargoyle, at least.
The other thing is that, in my fix, I'm guarding this all with #ifdef GARGLK
since it deviates from upstream here. However, it'd be better to get a proper upstream solution in place that works for all (Unix) Glks. If we can assume that glkunix_stream_open_pathame
is OK to use, then I think my approach is no worse than the existing one. I use stdio to write out the files, to guarantee working filenames. This avoids any mangling that may be done by the Glk implementation.
My use of the hugo_path_to_game
is also gnarly, and should be improved if it's going to actually be used upstream.