Section "paths"
To allow for the circumstances of a browser, we do not provide a
search path of multiple loca-tions and/or multiple file
extensions. Rather the mechanism is such that only one resource,
the Prolog flag system_url, is probed. Dogelog player can also
load native libraries written in the host programming language of
the target platform:
- library(N): (file spec)
- The file spec addresses the Prolog text library N.
- foreign(N): (file spec)
- The file spec addresses the native library N.
Plain file names in include/1 or ensure_loaded/1 are resolved
against the parent Prolog text. Otherwise, plain file names are
resolved against the Prolog flag base_url. The resolution result
can be inspected via the predicate absolute_file_name/2, although
it is not necessary to call this predicate before using file
systems operations.
The following file path predicates are provided:
- file_property(S, P):
- The predicate succeeds with the properties of the file S that
unify with P. The following file properties are support:
- type(T): The type T of the file, possible values “regular”,
“directory” and “other”.
- absolute_path(Q): The resolved and normalized path Q for the
file.
- last_modified(L): The last modified date in milliseconds of
the file.
set_file_property(S, P):
- The predicate assigns the property P to the file F. Currently
supports the file property last_modified/1 for file system
paths.
- absolute_file_name(F, G):
- absolute_file_name(F, G, L):
- The predicate succeeds in G with the absolute file name of F.
If F is already an absolute file name, then F is returned
unchanged, otherwise the F is resolved against the base file
path. The ternary predicate allows specifying absolute file
options. The following absolute file options are supported:
relative_to(R): R is the base file path, default is the Prolog
flag base_url.
- is_absolute_file_name(F):
- The predicate succeeds if F is an absolute file name. A file
name is considered absolute if it starts with a file separator
or if it contains a protocol separator before the first file
separator or in itself.
- file_directory_name(F, G):
- The predicate succeeds in G with the directory name of the
file name F. The trailing file separator is included in the
directory name.
- file_base_name(F, G):
- The predicate succeeds in G with the base name of the file
name F. File names with trailing file separator return empty
base name.
Kommentare