spedas/gui/utilities/
sourceroot.pro
Routines
top source SourceRoot
result = SourceRoot()
The SOURCEROOT function, in combination with FILEPATH, allows a program to locate other files within a routine source file's related directory tree.
For example, an IDL routine file named C:\myapp\abc.pro calls SOURCEROOT as in
PRO ABC PRINT, SOURCEROOT() ENDthe resulting output will be the string "C:\myapp".
If data associated with the application are in C:\myapp\mydata, a data file in this directory can be located via
IDL> datafile = FilePath('data.dat',$ IDL> ROOT=SourceRoot(), $ IDL> SUBDIR=['data'])The programmer can distribute the application to another user who may install the original directory tree into "D:\app". No code modifications would be required for this user to successfully locate the data.dat file.
If the routine ABC were compiled and saved to an IDL SAVE file and distributed, the SOURCEROOT function will return the path to the SAVE file instead.
Author information
- Author:
Jim Pendleton
File attributes
Modification date: | Thu Feb 13 16:41:47 2014 |
Lines: | 23 |