About IDL’s Path

IDL maintains a list of directories where it searches for .pro and .sav files in the system variable !PATH. If the IDL interpreter encounters a reference to a routine that is not already included in its list of compiled routines, it searches the directories specified in !PATH for a file name that matches the referenced routine; if it finds a file with a matching name, it compiles the file and continues execution. This process is described in Automatic Compilation and Execution.

When IDL starts, it reads the value of the IDL_PATH system preference to determine the initial value of the !PATH system variable. The value of the IDL_PATH preference is saved between IDL invocations, so changes made in one session will be present the next time IDL starts. See IDL System Preferences for more on the preference system.

After the value of the IDL_PATH preference has been loaded into the !PATH system variable, the IDL Workbench adds entries for any open, managed projects to the end of !PATH. See Automatic Path Management for details on managed projects.

The IDL Workbench allows you to change the value of the IDL_PATH system preference using the Window > Preferences dialog.

The Workbench Recognizes Duplicate Routine Names

The IDL Workbench now automatically checks for duplicate routine names and displays a warning icon at the relevant code line, and in the Problems View. There is also a preference setting that allows you to control this behavior.

Automatic Path Management

The IDL Workbench can manage a portion of the !PATH system variable for you, based on the state of the projects in your workspace. The rule followed by the IDL Workbench is simple: if you choose to let the workbench manage a project’s status on the path, it adds the project directory to the !PATH system variable when the project is open, and removes it when the project is closed. Specifically, for managed projects:

  • If the managed project is open, the IDL Workbench ensures that the project directory (including any subdirectories) is included in the list of directories specified by the !PATH system variable. If the directory is not present in !PATH, it is added at the end of the path specification.
  • If the managed project is closed, the IDL Workbench will remove the project directory from the list of directories specified by the !PATH system variable unless the project directory is also specified by the IDL_PATH preference.

Note: Prior to the IDL Workbench 7.0.3 update, entries for managed projects were added to the IDL_PATH preference rather than to the !PATH system variable.

Selecting Automatic Path Management

To change the automatic path management setting for a project, open the IDL Project Properties page of the Project Properties dialog and check or uncheck the Update IDL path when project is opened or closed checkbox.

Checking or unchecking the checkbox for an existing project and clicking either Apply or OK updates the value of !PATH as described above.

When is the Path Updated?

If the Update IDL path when project is opened or closed property is set, the !PATH system variable is updated when any of the following occurs:

  • A project is added to or deleted from the workspace
  • A project is opened or closed
  • A new directory is added to an existing project directory
  • The value of the Update IDL path when project is opened or closed property changes

Sources for the Initial Value of IDL_PATH

Most IDL system preferences can take their values from an environment variable. If you use the IDL_PATH environment variable to supply the initial value of the IDL_PATH preference (and thus of the !PATH system variable), changes you make to the path preference during an IDL session will not be used the next time IDL starts.

Similarly, you can specify an initial value for most IDL system preferences when invoking IDL at the command line, via the -pref command line switch or by specifying the value of the preference itself. A preference value specified at the command line overrides values stored in your user preference and values specified in environment variables.

To understand how IDL determines the initial value for a preference, see IDL System Preferences.

Managing Path Order

You can control the order in which directories are searched by manually reordering the directories in the IDL Paths preferences page.

The order you define in the Paths preference is preserved between sessions, unless the initial value of the preference comes from the IDL_PATH environment variable or from a command-line argument.

Tip: Beginning with the IDL Workbench 7.0.3 update, directories associated with managed projects are no longer added to the IDL_PATH preference; they are instead added to the end of the !PATH system variable. If you need to control the exact location of a managed project’s directory in IDL’s path, add the directory to the IDL_PATH preference manually.

Specifying Windows Network Paths

Microsoft Windows systems use two conventions for specifying the path to a network resource:

  • UNC Paths: UNC (Uniform Naming Convention) paths specify the network name of a computer, followed by the name of a directory (and potentially any number of subdirectories) that have been shared on the network. For example, suppose that a directory named Data that resides on a computer named DataServer has been shared, and that the Data directory contains a subdirectory named mars_orbiter. The UNC path to a JPEG file named 01Apr2009.jpg in the mars_orbiter directory would be:
  • Mapped Drives: Mapped drives are a convention whereby the path to a network resource is assigned to a drive letter by the system. For example, suppose that the path to the shared Data directory from the above example has been mapped to the Windows drive letter 'M'. The path to the same JPEG file using the mapped drive would be:

While IDL can resolve both path formats, it is more efficient to use the UNC path to a network resource when specifying directories to add to the the !PATH system variable. Directories specified using UNC paths will be located and searched for .pro and .sav files much more quickly than paths using mapped drives.