Reference Guide > F Routines > FILEPATH Function
  

FILEPATH Function
Standard Library function that returns the file path to use to open a file, when given a file name within the PV-WAVE distribution.
Optionally, can also return the file name of the user’s terminal and the default location for temporary files for the current operating system.
Usage
result = FILEPATH(filename)
Input Parameters
filename—A string containing the name of a file. Must be in all lowercase. Do not enter any device or directory information.
Returned Value
result—The fully qualified file path for filename.
Keywords
Subdirectory—The name of the subdirectory in the PV-WAVE distribution area in which filename is located.
Terminal—The file name of the user’s terminal.
Tmp—The path to the default location for temporary files for the current operating system (filename is a temporary or “scratch” file).
Discussion
FILEPATH is used to get path information for a file. It is not a search facility, but simply builds the file path by padding information based on the operating system and keyword information passed into the function in the system variable !Dir.
FILEPATH does not check for the existence of filename, but rather only contracts a fully qualified pathname. It does account for operating system dependencies.
This routine is useful when you are writing a procedure that will be used on different platforms that support PV-WAVE and will open files in the PV-WAVE distribution.
UNIX Examples
PRINT, FILEPATH('wvstartup')
; PV-WAVE prints:
;   <RW_DIR>/wave/wvstartup
; Where <RW_DIR> is the PV-WAVE installation directory.
full_name = FILEPATH('errplot', Subdirectory='lib/std')
PRINT, full_name
; PV-WAVE prints:
;   <RW_DIR>/wave/lib/std/errplot
; Where <RW_DIR> is the PV-WAVE installation directory.
PRINT, FILEPATH('dummy',/Terminal)
; PV-WAVE prints: /dev/tty
PRINT, FILEPATH('scratch10',/Tmp)
; PV-WAVE prints: /tmp/scratch10
Windows Examples
full_name = FILEPATH('errplot', Subdirectory='lib\std')
PRINT, full_name
; PV-WAVE output is similar to:
;    C:\RW\wave\lib\std\errplot
PRINT, FILEPATH('scratch10', /Tmp)
; PV-WAVE output is similar to:
;    C:\Users\guest\AppData\Local\Temp\scratch10
See Also
FINDFILE
System Variables:   !Dir,  !Path

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.