Search path for library files
LIBPATH determines the directories where library files are searched for by the function loadproc
Possible values: String or a sequence of strings.
By default, in the UNIX® and Linux® version of MuPAD®, LIBPATH is the subdirectory $MuPAD_ROOT_PATH/share/lib. It can be re-defined by calling MuPAD with the command line option -l.
The variable LIBPATH 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.
Changing LIBPATH is useful for library development. You may create a sub-directory of your home directory with the same structure as the library installation tree and store modified library files there. If you prepend the name of this sub-directory to the variable LIBPATH in your startup file userinit.mu, then MuPAD first looks for library files in your local directory before searching the system directory. Cf. Example 4.
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):