Home | Categories | Alphabetical | Classes | All Contents | [ < ] | [ > ]

EXPAND_PATH


Syntax | Return Value | Arguments | Keywords | Examples | Version History | See Also

The EXPAND_PATH function is used to expand a simple path-definition string into a full path listing. The returned path can be useful for setting the !PATH, and !HELP_PATH system variables, for example.

Note
The mechanism used by EXPAND_PATH to expand the path-definition string is the same as that is used to expand the contents of the environment variables IDL_PATH, IDL_DLM_PATH, and IDL_HELP_PATH at startup. See The Path Definition String below for more information.

The Path Definition String

EXPAND_PATH accepts a single argument, a scalar string that contains a simple path-definition string. EXPAND_PATH expands the path-definition string into a list of directories that can be assigned to the !PATH, !DLM_PATH, or !HELP_PATH system variables.

Note
The syntax of the path definition string describe here can also be used when setting the IDL_PATH, IDL_DLM_PATH, and IDL_HELP_PATH environment variables. When IDL reads the environment variable at startup, it will treat the contents of the environment variable in the same way EXPAND_PATH treats the path definition string.

IDL supports the following special notations within the path definition string:

Note
See !DLM_PATH for examples using the <IDL_BIN_DIRNAME> and <IDL_VERSION_DIRNAME> tokens.

Syntax

Result = EXPAND_PATH( String [, /ALL_DIRS] [, /ARRAY] [, COUNT=variable] [, /DLM] [, /HELP] )

Return Value

Returns a list of directories that can be assigned to the !PATH, !DLM_PATH, or !HELP_PATH system variables given a string path to be expanded.

Arguments

String

A scalar string containing the path-definition string to be expanded. See The Path Definition String for details.

Keywords

ALL_DIRS

Set this keyword to return all directories without concern for their contents, otherwise, EXPAND_PATH only returns those directories that contain .pro or .sav files.

ARRAY

Set this keyword to return the result as a string array with each element containing one path segment. In this case, there is no need for a separator character and none is supplied. Normally, the result is a string array with the path segments separated with the correct special delimiter character for the current operating system.

COUNT

Set this keyword to a named variable which returns the number of path segments contained in the result.

DLM

Set this keyword to return those directories that contain IDL Dynamically Loadable Module (.dlm) description files.

HELP

Set this keyword to return directories that contain help files. On UNIX platforms, help files are in Adobe Portable Document Format (.pdf), HTML format (.html or .htm), or have the file extension .help . On Windows systems, help files can be either HTML Help (.chm), WinHelp (.hlp), PDF (.pdf), or HTML (.html or .htm) files.

Examples

Example 1

Assume you have the following directory structure:

/home 
   myfile.txt 
   /programs 
      /pro 
         myfile.pro 

Search the /home directory and all its subdirectories, and return the directories containing .pro and .sav files:

PRINT, EXPAND_PATH('+/home') 

IDL prints:

/home/programs/pro 

Example 2

Search the same directory, but this time return all directories, not just those containing .pro and .sav files:

PRINT, EXPAND_PATH('+home', /ALL_DIRS) 

IDL prints:

/home/programs/pro:/home/programs 

Example 3

Print the default value of the !DLM_PATH system variable:

PRINT, EXPAND_PATH('<IDL_DEFAULT>', /DLM) 

Version History

Introduced: Pre 4.0

Modified to use the <IDL_*_PATH> syntax: 5.6

See Also

Running IDL Programs and IDL Environment System Variables


Home | Categories | Alphabetical | Classes | All Contents | [ < ] | [ > ]