《通链参考手册》


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

●语法设定:

pathname-host pathname &key case => host

pathname-device pathname &key case => device

pathname-directory pathname &key case => directory

pathname-name pathname &key case => name

pathname-type pathname &key case => type

pathname-version pathname => version

●参数和值:

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.

●详情:

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 Section 19.2.2.1.2 (Case in Pathname Components).

●例子:

 (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

●受制于:

The implementation and the host file system.

●例外情况:

Should signal an error of type type-error if its first argument is not a pathname.

●更多信息:

pathname, logical-pathname, Section 20.1 (File System Concepts), Section 19.1.2 (Pathnames as Filenames)

●说明: 无。


X3J13设计清单非标准部分,可查下面章节:


◇首页 § ◎章节目录 § □内容索引 § ○符号索引 § △术语表 § ※设计草案