The system file_search_path

The system directory is used to store system dependent files. Its main purpose is to allow different platforms sharing the same file system to share system independent files, such as .pl and .qof files, but still be able to locate the necessary system dependent files.

Generally, several system directories are defined by file_search_path/2 facts to include different host and operating system combinations. The reason for this is that certain system files are only machine dependent and can be shared by applications running on the same type of machine, but some system files are operating system dependent also.

The most commonly used system files are object files that are loaded by load_foreign_files/2 and load_foreign_executable/1 predicates. Quintus Prolog libraries, for example, make frequent use of system dependent foreign code, but also contain system independent files that are shared by all platforms. Therefore, the system dependent object files are stored in a system directory for each platform. The system directories are located under the library directory, and the library files use calls like these:

     :- load_foreign_files([system('file')], []).
     :- load_foreign_executable(system('file')).

to specify files located in system directories. The library object files are compiled for each platform at installation time, and placed in the system directory specific to the platform.

The file_search_path/2 list in ref-fdi-fsp-pre, shows the different combinations of system file_search_path facts for a Sun 4 running SunOS 5.x. The order of search starts at the most specific system definition, which includes the host and full operating system, and proceeds to less specific forms of the system definitions. Finally, if none of the system directories exist, or none contain the specified file, the current working directory is tried. This way, if Quintus Prolog is to run on a single platform, the system dependent files may reside in the same directory as the system independent files.