next | previous | forward | backward | up | top | index | toc | Macaulay2 website
Macaulay2Doc :: prefixPath

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 = /home/m2user/src/M2.git/M2/BUILD/dan/builds.tmp/ub22041-release-1.21-branch

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 = /home/m2user/src/M2.git/M2/BUILD/dan/builds.tmp/ub22041-release-1.21-branch

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 = /home/m2user/src/M2.git/M2/BUILD/dan/builds.tmp/ub22041-release-1.21-branch

See also

For the programmer

The object prefixPath is a list.