ssqq wrote:When I use with newlisp-GS:
on WIndows xp, Only valid path is $HOME.
Could I set many directory to load module without prefix directory name?
When given a relative pathname (as in your example: "module-xxx.lsp"),
load will assume that it is based upon the current working directory (WD). If you didn't change the WD in newlisp, then the WD is the one that was current when you launched newlisp. In your case, you probably started newlisp when your current WD was $HOME. That's why saying
(load "module-xxx.lsp"), in your case, was equivalent to
(load (append (env "HOME") "/" "module-xxx.lsp")).
And since the expression
(real-path) evaluates to the current WD -- expressed as a string -- in general,
(load "module-xxx.lsp") is equivalent to
(load (append (real-path) "/" "module-xxx.lsp")).
Using
load with an argument that is a relative pathname is usually what one wants. However, you can use an absolute pathname with
load.
ryuo is correct that there is no primitive procedure to load a file that is on some kind of a "path" (like the (standard) PATH environment variable). As ryuo said, you could write one yourself. However, I'd recommend not using the NEWLISPDIR environment variable for this "path", as at least one newLISP standard procedure uses it, namely
module. Just choose another one.
Happy hacking!