On some of the Unix-derived file systems on which Inform runs, filenames are case-sensitive, so that FISH and fish might be different files. This makes extension files, installed by the user, prone to being missed. The code in this section provides a routine to carry out file opening as if filenames are case-insensitive, and is used only for extensions.


§1. This section contains a single utility routine, contributed by Adam Thornton: a specialised, case-insensitive form of fopen(). It is specialised in that it is designed for opening extensions, where the file path will be case-correct up to the last two components of the path (the leafname and the immediately containing directory), but where the casing may be wrong in those last two components.

§2. If the exact filename or extension directory (case-correct) exists, CIFilingSystem::fopen() will choose it to open. If not, it will use strcasecmp() to find a file or directory with the same name but differing in case and use it instead. If it finds exactly one candidate file, it will then attempt to fopen() it and return the result.

If CIFilingSystem::fopen() succeeds, it returns a FILE * (passed back to it from the underlying fopen()). If CIFilingSystem::fopen() fails, it returns NULL, and errno is set accordingly: