There are mechanisms in the IDL Workbench (or the old IDLDE) to set the IDL !PATH, but I have not found them useful. I have a somewhat byzantine system to set my path, but it works well for me. Since there has been discussion on the newsgroup recently about problems others are having, I thought I would write up my method.

My requirements for setting the path:

1. I need to be able to control exactly what appeared in my path. It needs to be clear what is currently in the path and easy to change what will be in the path the next time I start IDL. I don’t need to be able to change my path while using IDL (though I think my solution could be used for that too).
2. Directories with subdirectories containing code (i.e. using +) should still appear as a single entry.
3. Needs to work for both the command line and the Workbench.

The system consists of three parts: a text file with directories, a startup file that looks at the text file, and a handy library routine that sets the path.

First, the text file specifying the path contains one directory per line. Here’s mine that I keep in my home directory. Lines starting with a + include subdirectories; lines beginning with a ; are ignored.

Next, I included a few lines in my startup file to read the text file. Here’s my startup file. If you set your startup file using PREF_SET it will be set for both the command line and the Workbench (I think this is true if you set it within the Workbench as well).

Finally, the startup file uses MG_SET_PATH (code, docs).

It may be complicated to setup, but it’s straightforward to change the path once setup and it hasn’t surprised me yet.