User Tools


Function PATHNAME-HOST, PATHNAME-DEVICE, PATHNAME-DIRECTORY, PATHNAME-NAME, PATHNAME-TYPE, PATHNAME-VERSION

Syntax

  • pathname-host pathname &key casehost
  • pathname-device pathname &key casedevice
  • pathname-directory pathname &key casedirectory
  • pathname-name pathname &key casename
  • pathname-type pathname &key casetype
  • pathname-version pathnameversion

Arguments and Values

Description

These functions return the components of pathname.

If the pathname designator is a pathname, it represents the name used to open the file. This may be, but is not required to be, the actual name of the file.

If case is supplied, it is treated as described in \secref\PathnameComponentCase.

Examples

(defparameter *q* (make-pathname :host "KATHY" :directory "CHAPMAN" :name "LOGIN" :type "COM"))

*Q*

*q*

#P"KATHY::[CHAPMAN]LOGIN.COM"

(pathname-host *q*)

"KATHY"

(pathname-name *q*)

"LOGIN"

(pathname-type *q*)

"COM"

Because namestrings are used, the results shown in the remaining examples are not necessarily the only possible results. Mappings from namestring representation to pathname representation are dependent both on the file system involved and on the implementation (since there may be several implementations which can manipulate the the same file system, and those implementations are not constrained to agree on all details). Consult the documentation for each implementation for specific information on how namestrings are treated that implementation.

VMS

;; VMS (pathname-directory (parse-namestring "[FOO.*.BAR]BAZ.LSP"))

(:ABSOLUTE "FOO" "BAR")

(pathname-directory (parse-namestring "[FOO.*.BAR]BAZ.LSP") :case :common)

(:ABSOLUTE "FOO" "BAR")

;; Unix (pathname-directory "foo.l")

NIL

(pathname-device "foo.l")

:UNSPECIFIC

(pathname-name "foo.l")

"foo"

(pathname-name "foo.l" :case :local)

"foo"

(pathname-name "foo.l" :case :common)

"FOO"

(pathname-type "foo.l")

"l"

(pathname-type "foo.l" :case :local)

"l"

(pathname-type "foo.l" :case :common)

"L"

(pathname-type "foo")

:UNSPECIFIC

(pathname-type "foo" :case :common)

:UNSPECIFIC

(pathname-type "foo.")

""

(pathname-type "foo." :case :common)

""

(pathname-directory (parse-namestring "/foo/bar/baz.lisp") :case :local)

(:ABSOLUTE "foo" "bar")

(pathname-directory (parse-namestring "/foo/bar/baz.lisp") :case :common)

(:ABSOLUTE "FOO" "BAR")

(pathname-directory (parse-namestring "../baz.lisp"))

(:RELATIVE :UP)

(pathname-directory (parse-namestring "/foo/BAR/../Mum/baz"))

(:ABSOLUTE "foo" "BAR" :UP "Mum")

(pathname-directory (parse-namestring "/foo/BAR/../Mum/baz") :case :common)

(:ABSOLUTE "FOO" "bar" :UP "Mum")

(pathname-directory (parse-namestring "/foo/*/bar/baz.l"))

(:ABSOLUTE "foo" :WILD "bar")

(pathname-directory (parse-namestring "/foo/*/bar/baz.l") :case :common)

(:ABSOLUTE "FOO" :WILD "BAR")

;; Symbolics LMFS (pathname-directory (parse-namestring ">foo>>bar>baz.lisp")) <r>(:ABSOLUTE "foo" :WILD-INFERIORS "bar") </r> (pathname-directory (parse-namestring ">foo>*>bar>baz.lisp")) <r>(:ABSOLUTE "foo" :WILD "bar") </r> (pathname-directory (parse-namestring ">foo>*>bar>baz.lisp") :case :common) <r>(:ABSOLUTE "FOO" :WILD "BAR") </r> (pathname-device (parse-namestring ">foo>baz.lisp")) <r>:UNSPECIFIC</r> </blockquote> ====Affected By==== The implementation and the host file system. ====Exceptional Situations==== Should signal an error of type type-error if its first argument is not a pathname. ====See Also==== * System Class PATHNAME * System Class LOGICAL-PATHNAME**

  • {\secref\FileSystemConcepts}
  • {\secref\PathnamesAsFilenames}

Notes

None.

\issue{PATHNAME-SUBDIRECTORY-LIST:NEW-REPRESENTATION} \issue{PATHNAME-COMPONENT-CASE:KEYWORD-ARGUMENT} \issue{PATHNAME-WILD:NEW-FUNCTIONS} \issue{PATHNAME-SUBDIRECTORY-LIST:NEW-REPRESENTATION} \issue{PATHNAME-LOGICAL:ADD} \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR} \issue{PATHNAME-COMPONENT-CASE:KEYWORD-ARGUMENT} \issue{PATHNAME-STREAM} \issue{PATHNAME-COMPONENT-CASE:KEYWORD-ARGUMENT} \issue{PATHNAME-UNSPECIFIC-COMPONENT:NEW-TOKEN}