11.3.109 library_directory/1 [hook]

Synopsis

:- multifile user:library_directory/1.

user:library_directory(+DirSpec)

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

Arguments

DirSpec
file_spec

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.

Description

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.

Examples

     | ?- assert(library_directory('/usr/joe_bob/prolog/libs')).
     
     yes
     | ?- 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.