Next: cpg-ref-SP_fail, Previous: cpg-ref-SP_exception_term, Up: cpg-bif [Contents][Index]
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.
The relative path to expand. It should be an encoded string. The
path is subject to syntactic rewriting, as if by
absolute_file_name/2.
If the 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()).
The following option bits can be set:
SP_EXPAND_FILE_NAME_OPTION_DIRThe relpath is expanded as a directory, i.e.
*pabspath will be slash terminated.
SP_EXPAND_FILE_NAME_OPTION_NO_CWDAn error is returned if the relpath is not an absolute path
after syntactic rewriting.
SP_EXPAND_FILE_NAME_OPTION_NO_ENVDo not expand system properties and environment variables during syntactic rewriting.
SP_EXPAND_FILE_NAME_OPTION_NO_HOMEDo not expand ‘~’ and ‘~user’ during syntactic rewriting.
SP_EXPAND_FILE_NAME_OPTION_ROOT_SLASHIf the expanded value would refer to the root directory, return a
slash terminated absolute path, as if
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_DOTIf the expanded value would refer to the root directory, return an
absolute path terminated with ‘/.’. 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.
On success, *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.