Setting Macaulay's file search path has been made more flexible, in part to support the stand-alone Macintosh version described in Section 2. The search path can be bootstrapped in a number of optional steps described below, or all but any one method can safely be ignored.
The search path is used to open files for reading, unless the file name contains a / character (Unix), or a : character (on the Macintosh), in which case the file name is used verbatim. The file name is always used verbatim when opening files for writing, unless the current directory mechanism (described later) is used.
Recall that a typical search path for Unix looks like
.:/usr/local/math/Macaulay/binwhere : separates directories, and . indicates the current directory. Directories must be specified without a trailing /.
A typical search path for the Macintosh looks like
:,A:user:Macaulay:bin:where , separates directories, and : indicates the current directory. All directories must be specified with a trailing :.
The search path is stored in the internal variable MclyPath, which is initialized in the file mac.c. This definition can be modified at a local installation to include (for example) the locations of standard script libraries, so individual users can run Macaulay with no additional preparation.
At startup, Macaulay reads the environment variable MacaulayPath, which either replaces or appends to the existing path. If MacaulayPath is defined, it appends to the existing path if it begins with a system-dependent separator character (, or :), and it replaces the existing path otherwise.
Macaulay next tries to find and open a file called Macaulay.path, searching for it using the search path constructed so far. If this file is found, it again replaces or appends to the existing search path, depending on whether or not it begins with a separator. A return character in Macaulay.path counts as a separator (so this file can list directories line by line), and trailing and redundant separators are ignored.
Later during startup, Macaulay tries to find and open a file called Macaulay.init, again searching for it using the search path constructed so far. If this file is found, Macaulay's greeting is shortened to a tolerable single line. This file can contain any commands that the user wants run every time at startup, such as the new path command. The path command can also be used interactively to add to the search path for the duration of a single Macaulay session.
If you rely on the environment variable MacaulayPath to set a particularly long path, you may wish to create empty files Macaulay.path and Macaulay.cdir (see the cdir command below) in the same directory as Macaulay.init, to avoid fruitless lengthy searches for these files at startup.