FILEPATH

The FILEPATH function returns the fully-qualified path to a file found in the IDL distribution. Operating system dependencies are taken into consideration. This routine is used by Research Systems to make the library routines portable. This routine is written in the IDL language. Its source code can be found in the file filepath.pro in the lib subdirectory of the IDL distribution.

Calling Sequence

Result = FILEPATH( Filename )

Arguments

Filename

A string containing the name of the file to be found. The file should be specified in all lowercase characters. No device or directory information should be included.

Keywords

ROOT_DIR

A string containing the name of the directory from which the resulting path should be based. If not present, the value of !DIR is used. This keyword is ignored if TERMINAL or TMP are specified.

SUBDIRECTORY

The name of the subdirectory in which the file should be found. If this keyword is omitted, the main IDL directory is used. This variable can be either a scalar string or a string array with the name of each level of subdirectory depth represented as an element of the array.

For example, to get a path to the file filepath.pro in IDL's lib subdirectory, enter:

path = FILEPATH('filepath.pro',SUBDIR=['lib'])

TERMINAL

Set this keyword to return the filename of the user's terminal.

TMP

Set this keyword to indicate that the specified file is a scratch file. Returns a path to the proper place for temporary files under the current operating system.

Under Microsoft Windows, FILEPATH checks to see if the following environment variables are set--TMP, TEMP, WINDIR--and uses the value of the first one it finds. If none of these environment variables exists, \TMP is used as the temporary directory.

Example

Open the IDL distribution file people.dat , found in the images subdirectory:

OPENR, 1, FILEPATH('people.dat', SUBDIRECTORY='images')

See Also

FINDFILE