The FILE_EXPAND_PATH function expands a given file or partial directory name to its fully qualified name and returns it regardless of the current working directory.
Note: This routine should be used only to make sure that file paths are fully qualified, but not to expand wildcard characters (e.g. *). The behavior of FILE_EXPAND_PATH when it encounters a wildcard is platform dependent, and should not be depended on. These differences are due to the underlying operating system, and are beyond the control of IDL. To expand wildcards and obtain fully qualified paths, use the FILE_SEARCH function with the FULLY_QUALIFY_PATH keyword:
A = FILE_SEARCH('*.pro', /FULLY_QUALIFY_PATH)
Note: On Windows operating systems, FILE_EXPAND_PATH does not work on environment variables such as $HOME. Use GETENV to retrieve the value.
In this example, we change directories to the IDL lib directory and expand the file path for the DIST function:
cd, FILEPATH('', SUBDIRECTORY=['lib'])
This results in the following if run on a UNIX system:
Result = FILE_EXPAND_PATH (Path)
FILE_EXPAND_PATH returns a fully qualified file path that completely specifies the location of Path without the need to consider the user’s current working directory. If Path is an empty string, FILE_EXPAND_PATH returns the fully qualified path to the current working directory.
A scalar or array of file or directory names to be fully qualified.
FILE_SEARCH, General File Access