11.3.109 library_directory/1 [hook]


:- multifile user:library_directory/1.


Defines a library directory. Used by predicates taking file_spec as input argument.



Either an atom giving the path to a file or directory, or PathAlias(DirSpec), where PathAlias is defined by a file_search_path/2 rule.


These facts define directories to search when a file specification library(File) is expanded to the full path, in addition to the predefined library path, which is tried first.

The file_search_path mechanism is an extension of the library_directory scheme.

The predicate 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.


     | ?- [user].
     % compiling user...
     | :- multifile user:library_directory/1.
     | library_directory('/usr/joe_bob/prolog/libs').
     | end_of_file.
     % compiled user in module user, 0 msec 384 bytes
     | ?- ensure_loaded(library(flying)).
     % loading file /usr/joe_bob/prolog/libs/flying.qof

See Also

absolute_file_name/[2,3], file_search_path/2, load_files/[1,2], ref-fdi.

Send feedback on this subject.