User Tools


Function PATHNAME

Syntax

  • pathname pathspecpathname

Arguments and Values

Description

Returns the pathname denoted by pathspec.

If the pathspec designator is a stream, the stream can be either open or closed; in both cases, the pathname returned corresponds to the filename used to open the file. pathname returns the same pathname for a file stream after it is closed as it did when it was open.

If the pathspec designator is a file stream created by opening a logical pathname, a logical pathname is returned.

Examples

There is a great degree of variability permitted here. The next several examples are intended to illustrate just a few of the many possibilities. Whether the name is canonicalized to a particular case (either upper or lower) depends on both the file system and the implementation since two different implementations using the same file system might differ on many issues. How information is stored internally (and possibly presented in #S notation) might vary, possibly requiring accessors such as pathname-name to perform case conversion upon access. The format of a namestring is dependent both on the file system and the implementation since, for example, one implementation might include the host name in a namestring, and another might not. #S notation would generally only be used in a situation where no appropriate namestring could be constructed for use with #P.

(defparameter *pathname-1* (pathname "test"))

*PATHNAME-1*

*pathname-1*

#P"CHOCOLATE:TEST" ; with case canonicalization (e.g., VMS)

or #P"VANILLA:test" ; without case canonicalization (e.g., Unix)

or #P"test"

or #S(PATHNAME :HOST "STRAWBERRY" :NAME "TEST")

or #S(PATHNAME :HOST "BELGIAN-CHOCOLATE" :NAME "test")

(defparameter *pathname-2* (pathname "test"))

*PATHNAME-2*

*pathname-2*

#P"CHOCOLATE:TEST"

or #P"VANILLA:test"

or #P"test"

or #S(PATHNAME :HOST "STRAWBERRY" :NAME "TEST")

or #S(PATHNAME :HOST "BELGIAN-CHOCOLATE" :NAME "test")

(pathnamep *pathname-1*)

true

(eq *pathname-1* (pathname *pathname-1*))

true

(eq *pathname-1* *pathname-2*)

true

or false

(with-open-file (stream "test" :direction :output) (pathname stream))

#P"ORANGE-CHOCOLATE:>Gus>test.lisp.newest"

Affected By

None.

Exceptional Situations

None.

See Also

Notes

None.

\issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR} \issue{PATHNAME-STREAM} \issue{CLOSED-STREAM-FUNCTIONS:ALLOW-INQUIRY} \issue{PATHNAME-LOGICAL:ADD} \issue{PATHNAME-LOGICAL:ADD}