read
, write
, append
, exist
, none
or
execute
. File may also be the name of a
directory. Fails silently otherwise. access_file(File, none)
simply succeeds without testing anything.
If `Mode' is write
or append
, this
predicate also succeeds if the file does not exist and the user has
write-access to the directory of the specified location.
/
.
If File is an atom that does not contain any directory
separator characters, the empty atom ''
is returned. See
also file_base_name/2.
~
and <user>
)
and variable expansion is done. The absolute path is canonised:
references to .
and ..
are deleted. SWI-Prolog
uses absolute file names to register source files independent of the
current working directory. See also absolute_file_name/3.
''
. 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 as ..ext
or
plain ext
.
read
, write
, append
, exist
or none
. See also access_file/2.
txt
implies ['']
,
prolog
implies ['.pl', '']
, executable
implies
['.so', '']
, qlf
implies ['.qlf', '']
and
directory
implies ['']
.
error
(default), throw and existence_error
exception if the file cannot be found. If fail
, stay
silent. footnote Silent operation was the default upto version 3.2.6.
first
(default), the predicates leaves no choice-point.
Otherwise a choice-point will be left and backtracking may yield more
solutions.
<letter>:
.
This predicate is intended to provide platform-independent checking for
absolute paths. See also absolute_file_name/2
and prolog_to_os_filename/2.
.
).
If an Extension is generated, it will not have a leading dot.
?
',
`*
', `[ ... ]
' and `{...}
'
are recognised. The interpretation of `{...}
' is
interpreted slightly different from the C shell (csh(1)). The comma
separated argument can be arbitrary patterns, including `{...}
'
patterns. The empty pattern is legal as well: `\{.pl,\}
'
matches either `.pl
' or the empty string.
Before expanding wildchards, the construct $var
is expanded to the value of the environment variable var and
a possible leading ~
character is expanded to the user's
home directory. (15).