also moe icons to docs/
3.9 KiB
@addtogroup absolute_file_name
@pred absolute_file_name(+File:atom, +Options:list, +Path:atom) is nondet @pred absolute_file_name(-File:atom, +Path:atom, +Options:list) is nondet
Options is a list of options to guide the conversion:
-
extensions(+ ListOfExtensions)
List of file-name suffixes to add to try adding to the file. The Default is the empty suffix,
''
. For each extension, absolute_file_name/3 will first add the extension and then verify the conditions imposed by the other options. If the condition fails, the next extension of the list is tried. Extensions may be specified both with dot, as.ext
, or without, as plainext
. -
relative_to(+ FileOrDir )
Resolve the path relative to the given directory or directory the holding the given file. Without this option, paths are resolved relative to the working directory (see working_directory/2) or, if Spec is atomic and absolute_file_name/3 is executed in a directive, it uses the current source-file as reference.
-
access(+ Mode )
Imposes the condition access_file( File , Mode ). Mode is one of
read
,write
,append
,exist
ornone
(default).See also access_file/2.
-
file_type(+ Type )
Defines suffixes matching one of several pre-specified type of files. Default mapping is as follows:
-
txt
implies[ '' ]
, -
prolog
implies['.yap', '.pl', '.prolog', '']
, -
executable
implies['.so', ',dylib', '.dll']
depending on the Operating system, -
qly
implies['.qly', '']
, -
directory
implies['']
, -
The file-type
source
is an alias forprolog
designed to support compatibility with SICStus Prolog. See also prolog_file_type/2.
Notice that this predicate only returns non-directories, unless the option
file_type(directory)
is specified, or unlessaccess(none)
. -
-
file_errors(
fail
/error
)If
error
(default), throwexistence_error
exception if the file cannot be found. Iffail
, stay silent. -
solutions(
first
/all
)If
first
(default), commit to the first solution. Otherwise absolute_file_name will enumerate all solutions via backtracking. -
expand(
true
/false
)If
true
(default isfalse
) and Spec is atomic, call expand_file_name/2 followed by member/2 on Spec before proceeding. This is originally a SWI-Prolog extension, but whereas SWI-Prolog implements its own conventions, YAP uses the shell'sglob
primitive. -
glob(
Pattern
)If Pattern is atomic, add the pattern as a suffix to the current expansion, and call expand_file_name/2 followed by member/2 on the result. This is originally a SICStus Prolog exception.
Both
glob
andexpand
rely on the same underlying mechanism. YAP gives preference toglob
. -
verbose_file_search(
true
/false
)If
true
(default isfalse
) output messages during search. This is often helpful when debugging. Corresponds to the SWI-Prolog flagverbose_file_search
(also available in YAP).
Compatibility considerations to common argument-order in ISO as well as SICStus absolute_file_name/3 forced us to be flexible here. If the last argument is a list and the second not, the arguments are swapped, making the call
absolute_file_name(+ _Spec_ , - _Path_ ,+ _Options_ )
valid as well.
@pred user:library_directory(?Directory:atom) is nondet, dynamic
Dynamic, multi-file predicate that succeeds when Directory is a current library directory name. Asserted in the user module.
Library directories are the places where files specified in the form
library( _File_ )
are searched by the predicates consult/1,
reconsult/1, use_module/1, ensure_loaded/1, and load_files/2.
This directory is initialized by a rule that calls the system predicate system_library/1.