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.
Create the following routine and save it in a file called ex_routine_filepath.pro:
result = DIST(100)
print, ROUTINE_FILEPATH("DIST", /EITHER)
When you compile and run this procedure, IDL prints (depending upon your paths):
Result = ROUTINE_FILEPATH( [Routine] [, /EITHER] [, /IS_FUNCTION] )
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.
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.
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.
Set this keyword to search for functions rather than procedures.
||Allow Routine argument to be omitted, and to return the path of the currently-scoped routine.
RESOLVE_ROUTINE, ROUTINE_INFO, ROUTINE_DIR