File Name Resolution¶
Support for file name resolution through absolute_file_name//33 and friends.
C-code support for dealing with absolute and relative paths.
These utility built-ins describe a list of directories that are used by load_files//22 to search. They include pre-compiled paths plus user-defined directories, directories based on environment variables and registry information to search for files.
This code provides the necessary built-ins to open, close and move around Linux, Unix, and OSX filesystems. It should also work in WIN32.
- absolute_file_name/2
- file_exists/1
- exists_source/3
- absolute_file_name/4
- remove_from_path/1
- add_to_path/2
- add_to_path/1
- path/1
Define:¶
Functions:¶
1. static Term do_glob(const char *spec, bool glob_vs_wordexp):
1. static const char * PlExpandVars(const char source, const char root):
1. static Term gethdir(Term t):
1. static Term issolutions(Term t):
1. static Term is_file_errors(Term t):
1. static Term is_file_type(Term t):
1. static const char * myrealpath(const char *path USES_REGS):
1. const char * Yap_AbsoluteFile(const char *spec, bool ok): : generate absolute path, if ok first expand SICStus Prolog style
spec gothe original spec;
rc0 may be an outout buffer rc1 the internal buffer
PlExpandVars
spec gothe original spec; rc1 the internal buffer
specthe file path, including ~
and $
.
okwhere to process ~
and $
.
return:
tmp, or NULL, in malloced memory
1. static Int real_path(USES_REGS1):
1. bool Yap_IsAbsolutePath(const char *p0, bool expand):
1. static Int true_file_name(USES_REGS1): : "true_file_name(A,B" )
@class true_file_name_2
Unify B with the absolute path to A.
1. static Int absolute_file_system_path(USES_REGS1):
1. static Int prolog_to_os_filename(USES_REGS1):
1. const char * Yap_GetFileName(Term t USES_REGS):
1. static Int file_name_extension(USES_REGS1): : "file_name_extension( ? BaseFile, ?Extension, ?FullNameO" )
@class file_name_extension_3
Relate a file name with an extension. The extension is the filename's suffix and indicates the kind of the file.
The predicate can be used to: Given FullName, extract the extension as Extension, and the remainder as BaseFile. - Given BaseFile and ?Extension obtain a FullNameO. Notice that:
- if no suffix is found, file_name_extension_51 "file_name_extension/3" generates the empty suffu]kx, '
. + the extension does not include the
,` separator; + the suffix may be longer thsn 3 characters + case should not matter in Windows and MacOS + paths may not correspond to valid file names.
return:
G
1. static Int p_expand_file_name(USES_REGS1):
1. static Int true_file_nam/3(USES_REGS1):
1. static Int path_concat(USES_REGS1):
1. static Int abs_file_parameters(USES_REGS1):
1. static Int get_abs_file_parameter(USES_REGS1):
1. static Int is_absolute_file_name(USES_REGS1):
1. static Int file_base_name(USES_REGS1):
1. static Int file_directory_name(USES_REGS1): : file_directory_name(+Path, -DirSubPath)
given a path, return the prefix of the path that describes the directory the path leads to.
Notice that the directory may not exist. In UNIX/Linux this is just the prefix for the last /
.
1. void Yap_InitAbsfPreds(void):
Var:¶
1. const param_t absolute_file_name_search_defs[][]:
Typedef:¶
1. typedef enum ABSOLUTE_FILE_NAME_enum_ absolute_file_name_choices_t: