Search path for the command ‘ Package '
PACKAGEPATH determines the directories, where the function package searches for packages.
Possible values: String or a sequence of strings.
The default of the path variable PACKAGEPATH are the subdirectories packages of the MuPAD® installation and directory .mupad in the users home directory. Cf. Example 3.
Additional paths can be given by calling MuPAD with the command line option -p.
Note: Computed results may differ after an external package is installed compared to those computed with the original software installation.
The variable PACKAGEPATH can represent more than one search directory. This variable can be assigned a sequence of strings: each element of the sequence represents a directory in which files are search for.
Note: When concatenated with a file name, the directories given by the path variables must produce valid path names.
Path names are slightly system dependent. You can separate subdirectories with a / on all systems. On Windows® systems, you may alternatively use a backslash character (\).
Note that in MuPAD, a single backslash inside a character string is created by typing two backslashes. E.g., the MuPAD string representing the path "C:\Programs\MuPAD" must be defined by "C:\\Programs\\MuPAD".
The function pathname allows to create path names independent of the current operating system.
This example shows how to define a READPATH. More than one path may be given. read will look for files to be opened in the directories given by READPATH. The following produces a valid READPATH for UNIX® and Linux® systems only, since the path separators are hard coded in the strings:
READPATH := "math/lib/", "math/local/"
It is good programming style to use platform independent path strings. This can be achieved with the function pathname:
READPATH := pathname("math", "lib"), pathname("math", "local")
All path variables can be set to their default values by deleting them:
The path variable WRITEPATH only accepts one path string:
WRITEPATH := "math/lib/", "math/local/"
Error: The argument is invalid. [WRITEPATH]
The default of the path variable PACKAGEPATH are the subdirectories packages of the MuPAD installation and directory .mupad in the users home directory:
Be careful when changing the LIBPATH. You can corrupt your MuPAD session:
LIBPATH := "does/not/exist": linalg::det
Error: Cannot read file 'LIBFILES/linalg.mu'. [loadproc]
You can always restore the standard search path by deleting LIBPATH:
delete LIBPATH: linalg::det
Changing the LIBPATH is useful for library development. You can build a directory "mylib" with the same directory structure as the MuPAD library. Let us assume that you have a patched version of the function linalg::det in the file "mylib/LINALG/det.mu". MuPAD will try to read the file "LINALG/det.mu" when the function linalg::det is called for the first time. Since the directory "mylib" contains this file, it will be read instead of the corresponding file in the standard library:
reset(): Pref::verboseRead(2): LIBPATH := pathname("mylib"), LIBPATH: linalg::det
loading package 'linalg' [<YourMuPADpath>/share/lib/] reading file mylib/LINALG/det.mu proc linalg::det(A) ... end
Please restore your session:
delete LIBPATH: Pref::verboseRead(0):