The function
current-pathname
is useful for loading other files relative to a file.
current-pathname
computes a pathname from the current operation as follows:
Uses
*compile-file-pathname*
.
When evaluating or compiling an Editor buffer
Uses the pathname of the buffer.
Uses the current working directory.
The argument relative-pathname is merged with the pathname computed above. The pathname-type of the result pathname is set to type if supplied, and pathname is returned.
A useful value for
type
is
nil
, which can be used to allow
load
to choose between lisp or fasl regardless of the type of the current pathname.
Note:
defsystem
uses current-pathname with its :
default-host
argument.
To load
aux-file.lisp
or the binary, regardless of the current pathname:
(load (current-pathname "aux-file" nil))
=>
#P"C:/temp/aux-file.lisp"
#P"/tmp/aux-file.lisp"