Next: , Previous: , Up: Filenames Dictionary  


19.4.6 pathname-host, pathname-device, pathname-directory,

pathname-name, pathname-type, pathname-version

[Function]

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::

pathname—a pathname designator.

case—one of :local or :common. The default is :local.

host—a valid pathname host.

device—a valid pathname device.

directory—a valid pathname directory.

name—a valid pathname name.

type—a valid pathname type.

version—a valid pathname version.

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 Case in Pathname Components.

Examples::

 (setq q (make-pathname :host "KATHY"
                        :directory "CHAPMAN" 
                        :name "LOGIN" :type "COM"))
⇒  #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
 (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 :local)
⇒  (: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"))
⇒  (:ABSOLUTE "foo" :WILD-INFERIORS "bar")
 (pathname-directory (parse-namestring ">foo>*>bar>baz.lisp"))
⇒  (:ABSOLUTE "foo" :WILD "bar")
 (pathname-directory (parse-namestring ">foo>*>bar>baz.lisp") :case :common)
⇒  (:ABSOLUTE "FOO" :WILD "BAR")
 (pathname-device (parse-namestring ">foo>baz.lisp")) ⇒  :UNSPECIFIC

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::

pathname, logical-pathname, File System Concepts,

Pathnames as Filenames


Next: , Previous: , Up: Filenames Dictionary