The FILEPATH function returns the fully-qualified path to a file contained in the IDL distribution. Operating system dependencies are taken into consideration. This routine is used to make the library routines portable.
Open the IDL distribution file people.dat:
OPENR, 1, FILEPATH('people.dat', SUBDIRECTORY=['examples','data'])
Result = FILEPATH( Filename [, ROOT_DIR=string] [, SUBDIRECTORY=string/string_array] [, /TERMINAL] [, /TMP] )
Returns the fully-qualified path to a specified file.
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.
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.
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 calendar.pro in IDL’s lib subdirectory, enter:
path = FILEPATH('calendar.pro',SUBDIR=['lib'])
Set this keyword to return the filename of the user’s terminal.
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.