ROUTINE_FILEPATH
The ROUTINE_FILEPATH function returns the full path to a currently-compiled procedure or function (or a list of procedures and functions).
Tip: You can use the ROUTINE_DIR function to return the path without the filename.
Examples
Create the following routine and save it in a file called ex_routine_filepath.pro
:
pro ex_routine_filepath
; Where is my current routine located?
print, ROUTINE_FILEPATH()
result = DIST(100)
; Where is the DIST routine located?
print, ROUTINE_FILEPATH("DIST", /EITHER)
end
When you compile and run this procedure, IDL prints (depending upon your paths):
C:\Users\myname\MyWorkspace\Default\ex_routine_filepath.pro
C:\Program Files\MyIDLInstall\lib\dist.pro
Syntax
Result = ROUTINE_FILEPATH( [Routine] [, /EITHER] [, /IS_FUNCTION] )
Return Value
Returns a scalar string or string array containing the full path for each element of the Routine argument. If the routine is not in the list of currently-compiled routines, an empty string is returned.
Arguments
Routine
Routine is a scalar string or string array containing routine names for which the file path is desired. If Routine contains functions rather than procedures, you must set the IS_FUNCTION or EITHER keyword.
If Routine is omitted then the full path to the currently-scoped routine is returned. In this case you do not need to specify any keywords: IDL will automatically use the EITHER keyword.
Keywords
EITHER
If set, this keyword indicates that the caller does not know whether the supplied routine names are functions or procedures, and will accept paths for either. This keyword overrides the IS_FUNCTION keyword.
IS_FUNCTION
Set this keyword to search for functions rather than procedures.
Version History
7.0 |
Introduced |
8.2.2 | Allow Routine argument to be omitted, and to return the path of the currently-scoped routine. |