FILE_EXPAND_PATH

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.

Examples

In this example, we change directories to the IDL lib directory and expand the file path for the DIST function:

cd, FILEPATH('', SUBDIRECTORY=['lib'])

print, FILE_EXPAND_PATH('dist.pro')

This results in the following if run on a UNIX system:

/usr/local/***/idl/lib/dist.pro

Note:

Syntax

Result = FILE_EXPAND_PATH (Path)

Return Value

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.

Arguments

Path

A scalar or array of file or directory names to be fully qualified.

Keywords

None.

Version History

5.4

Introduced

See Also

FILE_SEARCH, General File Access