SP_expand_file_name()
#include <sicstus/sicstus.h> spio_t_error_code SP_expand_file_name( char const *relpath, char const *cwd, spio_t_bits options, char **pabspath);
Expand a file name into an absolute path.
absolute_file_name/2
.
relpath
is a relative path, it is expanded relative to
cwd
, unless cwd
is NULL
. If cwd
is
NULL
, a relative relpath
is expanded relative to the
SICStus working directory (as returned by SP_get_current_dir()
).
SP_EXPAND_FILE_NAME_OPTION_DIR
relpath
is expanded as a directory, i.e.
*pabspath
will be slash terminated.
SP_EXPAND_FILE_NAME_OPTION_NO_CWD
relpath
is not an absolute path
after syntactic rewriting.
SP_EXPAND_FILE_NAME_OPTION_NO_ENV
SP_EXPAND_FILE_NAME_OPTION_NO_HOME
SP_EXPAND_FILE_NAME_OPTION_ROOT_SLASH
SP_EXPAND_FILE_NAME_OPTION_DIR
had been set. By default, an
error is returned if the expanded absolute path would refer to a root
directory and SP_EXPAND_FILE_NAME_OPTION_DIR
is not set.
SP_EXPAND_FILE_NAME_OPTION_ROOT_DOT
SP_EXPAND_FILE_NAME_OPTION_DIR
is not set.
*pabspath
is set to the expanded path. This value is
allocated with SP_malloc()
and should be freed with
SP_free()
.
On success, *pabspath
is set to the expanded path and SPIO_S_NOERR
or some other success code is returned.
On failure, an error code is returned.
cpg-ref-SP_get_current_dir. See ref-fdi-syn, for a description of syntactic rewriting. OS File System.