4.5.1.3 Predefined File Search Paths

user:file_search_path/2 is undefined at startup, but behaves as if it were a multifile predicate with the following clauses. See ref-lps-flg for more info on the Prolog flag host_type. The environment variables SP_APP_DIR and SP_RT_DIR expand respectively to the absolute path of the directory that contains the executable and the directory that contains the SICStus run-time. The environment variable SP_TEMP_DIR expands to a directory suitable for storing temporary files, it is particularly useful with the open/4 option if_exists(generate_unique_name).

     file_search_path(library, Path) :-
             library_directory(Path).
     file_search_path(system, Platform) :-
             prolog_flag(host_type, Platform).
     file_search_path(application, '$SP_APP_DIR').
     file_search_path(runtime, '$SP_RT_DIR').
     file_search_path(temp, '$SP_TEMP_DIR').
     file_search_path(path, Path) :-
      %% enumerate all directories in $PATH
      ...

user:library_directory/1 is undefined at startup, but behaves as if it were a multifile predicate with a single clause defining the location of the Prolog library. The initial value is the same as the value of the environment variable SP_LIBRARY_DIR. The predicate may succeed nondeterminately in this search for a library directory.


Send feedback on this subject.