Next Prev Up Top Contents Index

current-pathname

Function
Summary

Computes a pathname relative to the current path.

Package

lispworks

Signature

current-pathname &optional relative-pathname type => pathname

Arguments

relative-pathname

A pathname designator.

type

A string or nil . The default is nil .

Values

pathname

A pathname.

Description

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:

When loading a file

Uses *load-pathname* .

When compiling a file

Uses *compile-file-pathname* .

When evaluating or compiling an Editor buffer

Uses the pathname of the buffer.

Otherwise

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.

Examples

To load aux-file.lisp or the binary, regardless of the current pathname:

(load (current-pathname "aux-file" nil))

While loading aux-file.lisp :

(current-pathname "aux-file")

=>
#P"C:/temp/aux-file.lisp"

or

#P"/tmp/aux-file.lisp"
See also

defsystem


LispWorks Reference Manual - 25 Jul 2003

Next Prev Up Top Contents Index