library_directory/1 extendable

Synopsis

:- multifile library_directory/1. 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 PathAlias(DirSpec), where PathAlias is defined by a file_search_path rule (see the reference page for file_search_path/2).

Description

The dynamic, multifile library_directory/1 facts reside in module user. They define directories to search when a file specification library(File) is expanded to the full path.

There are a set of predefined library_directory/1 facts, but users may also define their own libraries simply by asserting the appropriate library_directory/1 facts into module user. To locate a library file, the library_directory/1 facts are tried one by one in the same sequence they appear in the Prolog database.

The file_search_path mechanism is an extension of the library_directory scheme. See file_search_path/2 and ref-fdi.

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], assert/[1,2], dynamic/1, file_search_path/2, listing/1, load_files/[1,2] ref-fdi.