next up previous
Next: The args command Up: Changes Previous: The path command

The current directory, and the cdir command

This section can safely be ignored, unless you are using the stand-alone Macintosh version, or you need better control of the directory to which which files are written by Macaulay.

Analogous to the internal variable MclyPath for path handling is another internal variable MclyCdir for setting the current directory. It starts out NULL, and can be controlled by a set of methods parallel to those that control MclyPath: the source file mac.c, the environment variable MacaulayCdir, the file Macaulay.cdir, and the command cdir. If used, this variable must specify a single directory, without a trailing / on Unix systems, and with a trailing : on the Macintosh.

If the current directory is not set, then the search path is used to open files for reading, and file names are used verbatim to open files for writing. If the current directory is set, then the first attempt to open a file within Macaulay for reading or writing is made using this prefix. If this attempt fails for reading, then the search path is used. If the current directory is set by the source file mac.c or the environment variable MacaulayCdir, then this strategy will already be in effect for the searches for the files Macaulay.path and Macaulay.cdir.

Bear in mind that this current directory facility is simply a means of automatically prefixing file names; it doesn't interact with the operating system to change the operating system's notion of the default directory. In particular, the system-dependent character . or : in the search path refers by itself to the operating system's notion of the default directory, bypassing this facility.

The cdir command with no arguments gives help, and the current directory if it is defined (Macintosh version shown):

% cdir
cdir <prefix>  (to set)
cdir :         (to clear)

With an argument, it sets or clears the current directory.


next up previous
Next: The args command Up: Changes Previous: The path command

Sorin Popescu
Sun Dec 22 18:20:57 EST 1996