Next: , Previous: Program Self-Knowledge, Up: Program Self-Knowledge

6.3.1 File-System Habitat

Where should software reside? Although individually a minor annoyance, cumulatively this question represents many thousands of frustrated user hours spent trying to find support files or guessing where packages need to be installed. Even simple programs require proper habitat; games need to find their score files.

Aren't there standards for this? Some Operating Systems have devised regimes of software habitats – only to have them violated by large software packages and imports from other OS varieties.

In some programs, the expected locations of support files are fixed at time of compilation. This means that the program may not run on configurations unanticipated by the authors. Compiling locations into a program also can make it immovable – necessitating recompilation to install it.

Programs of the world unite! You have nothing to lose but loss itself.

The function find_impl_file in scm.c is an attempt to create a utility (for inclusion in programs) which will hide the details of platform-dependent file habitat conventions. It takes as input the pathname of the executable file which is running. If there are systems for which this information is either not available or unrelated to the locations of support files, then a higher level interface will be needed.

— Function: char * find_impl_file (char *exec_path, char *generic_name, char *initname, char *sep)

Given the pathname of this executable (exec_path), test for the existence of initname in the implementation-vicinity of this program. Return a newly allocated string of the path if successful, 0 if not. The sep argument is a null-terminated string of the character used to separate directory components.