- Documentation
- Reference manual
- Built-in Predicates
- File System Interaction
- access_file/2
- exists_file/1
- file_directory_name/2
- file_base_name/2
- same_file/2
- exists_directory/1
- delete_file/1
- rename_file/2
- size_file/2
- time_file/2
- absolute_file_name/2
- absolute_file_name/3
- is_absolute_file_name/1
- file_name_extension/3
- directory_files/2
- expand_file_name/2
- prolog_to_os_filename/2
- read_link/3
- tmp_file/2
- tmp_file_stream/3
- make_directory/1
- delete_directory/1
- working_directory/2
- chdir/1
- File System Interaction
- Built-in Predicates
- Packages
- Reference manual
Availability:built-in
.
, ..
and
repeated directory separators (/
) are deleted.
This predicate ensures that expanding a filename returns the same
absolute path regardless of how the file is addressed. Notably, if a
file appears in multiple directories due to symbolic or hard links absolute_file_name/2
returns the same absolute filename. SWI-Prolog uses absolute filenames
to register source files independent of the current working directory.
This predicate has a different history than absolute_file_name/3 and should primarily be used to get an absolute canonical name from a relative name. If File is a term Alias(Relative) is behaviour is defined as below, i.e., if an accessible file can be found using the provided search path this is returned. Otherwise it returns the the expansion of the alias path.157The SICStus implementation behaves as absolute_file_name/3 with an empty option list. Users are advised to use absolute_file_name/3 with appropriate options for resolving an Alias(Relative) term.
absolute_file_name(Spec, AbsFile) :- absolute_file_name(Spec, File, [access(read), file_errors(fail)]), !, AbsFile = File. absolute_file_name(Spec, AbsFile) :- absolute_file_name(Spec, AbsFile, []).
See also absolute_file_name/3, file_search_path/2, and expand_file_name/2.