Macaulay2 » Documentation
Packages » Macaulay2Doc :: prefixPath
next | previous | forward | backward | up | index | toc

prefixPath -- absolute locations of Macaulay2 files


The absolute location of a Macaulay2 file can be obtained by concatenating three components: (a) the prefix, which is one of the members of the list prefixPath; (b) the relative location of the directory containing the file, as recorded in the hash table Layout; and (c) the base name of the file. The value of prefixPath is used by installPackage when determining how to direct documentation hyperlinks from one package to another.

The initial value of prefixPath contains just the following two optional items. If the variable prefixDirectory was given a non-null value initially or by a -e command line argument, then it will be the last element of prefixPath. If the -q option was not given on the command line used to invoke Macaulay2, then the value of applicationDirectory()|"local/" will be the first element of prefixPath. No attempt is made to synchronize the value of prefixPath with the values of prefixDirectory and of applicationDirectory(), which may change.

When running a newly compiled version of Macaulay2, adding something like -E 'prefixDirectory="/usr/"' to the command line is a good way to direct hyperlinks created by installPackage to the documentation provided by an older copy of Macaulay2 installed with the prefix /usr/, and that, in turn, is easily done within emacs by the keystroke sequence C-u f12, which offers you a chance to edit the command line.

The initial value of prefixPath described above can be overridden by the user's initialization file).

The list prefixPath should be distinguished from the list path, which is used to locate files to be loaded, by functions such as searchPath, load, loadPackage, and needsPackage.

The following example shows the list of places where we might find the source code of a package called Foo after it has been installed by installPackage.

i1 : stack apply(prefixPath, p -> p | Layout#1#"packages" | "Foo.m2")

o1 = /usr/local/share/Macaulay2/Foo.

This example shows the list of places where we might reasonably find the html file documenting a function named bar in a package called Foo.

i2 : stack apply(prefixPath, p -> p | replace("PKG","Foo",Layout#1#"packagehtml") | "bar.html")

o2 = /usr/local/share/doc/Macaulay2/

This example shows the list of places where we might reasonably find the info file documenting a package called Foo.

i3 : stack apply(prefixPath, p -> p | Layout#1#"info" | "")

o3 = /usr/local/share/info/

See also

For the programmer

The object prefixPath is a list.