103 lines
9.4 KiB
HTML
103 lines
9.4 KiB
HTML
<!-- Common Lisp HyperSpec (TM), version 7.0 generated by Kent M. Pitman on Mon, 11-Apr-2005 2:31am EDT -->
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE>CLHS: Function MAKE-PATHNAME</TITLE>
|
|
<LINK HREF="../Data/clhs.css" REL="stylesheet" TYPE="text/css" />
|
|
<META HTTP-EQUIV="Author" CONTENT="Kent M. Pitman">
|
|
<META HTTP-EQUIV="Organization" CONTENT="LispWorks Ltd.">
|
|
<LINK REL=TOP HREF="../Front/index.htm">
|
|
<LINK REL=COPYRIGHT HREF="../Front/Help.htm#Legal">
|
|
<LINK REL=DISCLAIMER HREF="../Front/Help.htm#Disclaimer">
|
|
<LINK REL=PREV HREF="f_pn.htm">
|
|
<LINK REL=UP HREF="c_filena.htm">
|
|
<LINK REL=NEXT HREF="f_pnp.htm">
|
|
</HEAD>
|
|
<BODY>
|
|
<H1><A REV=MADE HREF="http://www.lispworks.com/"><IMG WIDTH=80 HEIGHT=65 ALT="[LISPWORKS]" SRC="../Graphics/LWSmall.gif" ALIGN=Bottom></A><A REL=TOP HREF="../Front/index.htm"><IMG WIDTH=237 HEIGHT=65 ALT="[Common Lisp HyperSpec (TM)]" SRC="../Graphics/CLHS_Sm.gif" ALIGN=Bottom></A> <A REL=PREV HREF="f_pn.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="c_filena.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="f_pnp.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
|
|
|
|
<HR>
|
|
|
|
<A NAME="make-pathname"><I>Function</I> <B>MAKE-PATHNAME</B></A> <P>
|
|
<P><B>Syntax:</B><P>
|
|
<P>
|
|
|
|
<B>make-pathname</B> <I><TT>&key</TT> host device directory name type version defaults case</I><P> => <I>pathname</I><P>
|
|
<P>
|
|
<P><B>Arguments and Values:</B><P>
|
|
<P>
|
|
<I>host</I>---a <A REL=DEFINITION HREF="26_glo_v.htm#valid_physical_pathname_host"><I>valid physical pathname host</I></A>. Complicated defaulting behavior; see below. <P>
|
|
<I>device</I>---a <A REL=DEFINITION HREF="26_glo_v.htm#valid_pathname_device"><I>valid pathname device</I></A>. Complicated defaulting behavior; see below. <P>
|
|
<I>directory</I>---a <A REL=DEFINITION HREF="26_glo_v.htm#valid_pathname_directory"><I>valid pathname directory</I></A>. Complicated defaulting behavior; see below. <P>
|
|
<I>name</I>---a <A REL=DEFINITION HREF="26_glo_v.htm#valid_pathname_name"><I>valid pathname name</I></A>. Complicated defaulting behavior; see below. <P>
|
|
<I>type</I>---a <A REL=DEFINITION HREF="26_glo_v.htm#valid_pathname_type"><I>valid pathname type</I></A>. Complicated defaulting behavior; see below. <P>
|
|
<I>version</I>---a <A REL=DEFINITION HREF="26_glo_v.htm#valid_pathname_version"><I>valid pathname version</I></A>. Complicated defaulting behavior; see below. <P>
|
|
<I>defaults</I>---a <A REL=DEFINITION HREF="26_glo_p.htm#pathname_designator"><I>pathname designator</I></A>. The default is a <A REL=DEFINITION HREF="26_glo_p.htm#pathname"><I>pathname</I></A> whose host component is the same as the host component of the <A REL=DEFINITION HREF="26_glo_v.htm#value"><I>value</I></A> of <A REL=DEFINITION HREF="v_defaul.htm#STdefault-pathname-defaultsST"><B>*default-pathname-defaults*</B></A>, and whose other components are all <A REL=DEFINITION HREF="a_nil.htm#nil"><B>nil</B></A>. <P>
|
|
<I>case</I>---one of <TT>:common</TT> or <TT>:local</TT>. The default is <TT>:local</TT>. <P>
|
|
<I>pathname</I>---a <A REL=DEFINITION HREF="26_glo_p.htm#pathname"><I>pathname</I></A>. <P>
|
|
<P><B>Description:</B><P>
|
|
<P>
|
|
Constructs and returns a <A REL=DEFINITION HREF="26_glo_p.htm#pathname"><I>pathname</I></A> from the supplied keyword arguments. <P>
|
|
After the components supplied explicitly by <I>host</I>, <I>device</I>, <I>directory</I>, <I>name</I>, <I>type</I>, and <I>version</I> are filled in, the merging rules used by <A REL=DEFINITION HREF="f_merge_.htm#merge-pathnames"><B>merge-pathnames</B></A> are used to fill in any unsupplied components from the defaults supplied by <I>defaults</I>. <P>
|
|
Whenever a <A REL=DEFINITION HREF="26_glo_p.htm#pathname"><I>pathname</I></A> is constructed the components may be canonicalized if appropriate. For the explanation of the arguments that can be supplied for each component, see <A REL=CHILD HREF="19_ba.htm">Section 19.2.1 (Pathname Components)</A>. <P>
|
|
If <I>case</I> is supplied, it is treated as described in <A REL=CHILD HREF="19_bbab.htm">Section 19.2.2.1.2 (Case in Pathname Components)</A>. <P>
|
|
The resulting <I>pathname</I> is a <A REL=DEFINITION HREF="26_glo_l.htm#logical_pathname"><I>logical pathname</I></A> if and only its host component is a <A REL=DEFINITION HREF="26_glo_l.htm#logical_host"><I>logical host</I></A> or a <A REL=DEFINITION HREF="26_glo_s.htm#string"><I>string</I></A> that names a defined <A REL=DEFINITION HREF="26_glo_l.htm#logical_host"><I>logical host</I></A>. <P>
|
|
If the <I>directory</I> is a <A REL=DEFINITION HREF="26_glo_s.htm#string"><I>string</I></A>, it should be the name of a top level directory, and should not contain any punctuation characters; that is, specifying a <A REL=DEFINITION HREF="26_glo_s.htm#string"><I>string</I></A>, <I>str</I>, is equivalent to specifying the list <TT>(:absolute </TT><I>str</I><TT>)</TT>. Specifying the symbol <TT>:wild</TT> is equivalent to specifying the list <TT>(:absolute :wild-inferiors)</TT>, or <TT>(:absolute :wild)</TT> in a file system that does not support <TT>:wild-inferiors</TT>. <P>
|
|
<P><B>Examples:</B><P>
|
|
<P>
|
|
<PRE>
|
|
;; Implementation A -- an implementation with access to a single
|
|
;; Unix file system. This implementation happens to never display
|
|
;; the `host' information in a namestring, since there is only one host.
|
|
(make-pathname :directory '(:absolute "public" "games")
|
|
:name "chess" :type "db")
|
|
=> #P"/public/games/chess.db"
|
|
|
|
;; Implementation B -- an implementation with access to one or more
|
|
;; VMS file systems. This implementation displays `host' information
|
|
;; in the namestring only when the host is not the local host.
|
|
;; It uses a double colon to separate a host name from the host's local
|
|
;; file name.
|
|
(make-pathname :directory '(:absolute "PUBLIC" "GAMES")
|
|
:name "CHESS" :type "DB")
|
|
=> #P"SYS$DISK:[PUBLIC.GAMES]CHESS.DB"
|
|
(make-pathname :host "BOBBY"
|
|
:directory '(:absolute "PUBLIC" "GAMES")
|
|
:name "CHESS" :type "DB")
|
|
=> #P"BOBBY::SYS$DISK:[PUBLIC.GAMES]CHESS.DB"
|
|
|
|
;; Implementation C -- an implementation with simultaneous access to
|
|
;; multiple file systems from the same Lisp image. In this
|
|
;; implementation, there is a convention that any text preceding the
|
|
;; first colon in a pathname namestring is a host name.
|
|
(dolist (case '(:common :local))
|
|
(dolist (host '("MY-LISPM" "MY-VAX" "MY-UNIX"))
|
|
(print (make-pathname :host host :case case
|
|
:directory '(:absolute "PUBLIC" "GAMES")
|
|
:name "CHESS" :type "DB"))))
|
|
>> #P"MY-LISPM:>public>games>chess.db"
|
|
>> #P"MY-VAX:SYS$DISK:[PUBLIC.GAMES]CHESS.DB"
|
|
>> #P"MY-UNIX:/public/games/chess.db"
|
|
>> #P"MY-LISPM:>public>games>chess.db"
|
|
>> #P"MY-VAX:SYS$DISK:[PUBLIC.GAMES]CHESS.DB"
|
|
>> #P"MY-UNIX:/PUBLIC/GAMES/CHESS.DB"
|
|
=> NIL
|
|
</PRE>
|
|
</TT> <P>
|
|
<P><B>Affected By:</B><P>
|
|
<P>
|
|
The <A REL=DEFINITION HREF="26_glo_f.htm#file_system"><I>file system</I></A>. <P>
|
|
<P><B>Exceptional Situations:</B> None.
|
|
<P>
|
|
<P><B>See Also:</B><P>
|
|
<P>
|
|
<A REL=DEFINITION HREF="f_merge_.htm#merge-pathnames"><B>merge-pathnames</B></A>, <A REL=DEFINITION HREF="t_pn.htm#pathname"><B>pathname</B></A>, <A REL=DEFINITION HREF="t_logica.htm#logical-pathname"><B>logical-pathname</B></A>, <A REL=CHILD HREF="20_a.htm">Section 20.1 (File System Concepts)</A>, <A REL=CHILD HREF="19_ab.htm">Section 19.1.2 (Pathnames as Filenames)</A> <P>
|
|
<P><B>Notes:</B><P>
|
|
<P>
|
|
Portable programs should not supply <TT>:unspecific</TT> for any component. See <A REL=CHILD HREF="19_bbbc.htm">Section 19.2.2.2.3 (:UNSPECIFIC as a Component Value)</A>. <P>
|
|
<P><HR>The following <A REL=META HREF="../Front/X3J13Iss.htm">X3J13 cleanup issues</A>, <I>not part of the specification</I>, apply to this section:<P><UL><LI> <A REL=CHILD HREF="../Issues/iss157.htm">FILE-OPEN-ERROR:SIGNAL-FILE-ERROR</A><LI> <A REL=CHILD HREF="../Issues/iss263.htm">PATHNAME-SUBDIRECTORY-LIST:NEW-REPRESENTATION</A><LI> <A REL=CHILD HREF="../Issues/iss259.htm">PATHNAME-LOGICAL:ADD</A><LI> <A REL=CHILD HREF="../Issues/iss258.htm">PATHNAME-HOST-PARSING:RECOGNIZE-LOGICAL-HOST-NAMES</A><LI> <A REL=CHILD HREF="../Issues/iss256.htm">PATHNAME-COMPONENT-CASE:KEYWORD-ARGUMENT</A><LI> <A REL=CHILD HREF="../Issues/iss266.htm">PATHNAME-UNSPECIFIC-COMPONENT:NEW-TOKEN</A><P></UL><HR>
|
|
|
|
<A REL=NAVIGATOR HREF="../Front/StartPts.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Starting Points]" SRC="../Graphics/StartPts.gif" ALIGN=Bottom></A><A REL=TOC HREF="../Front/Contents.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Contents]" SRC="../Graphics/Contents.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Master.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Index]" SRC="../Graphics/Index.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Symbol.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Symbols]" SRC="../Graphics/Symbols.gif" ALIGN=Bottom></A><A REL=GLOSSARY HREF="../Body/26_a.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Glossary]" SRC="../Graphics/Glossary.gif" ALIGN=Bottom></A><A HREF="../Front/X3J13Iss.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Issues]" SRC="../Graphics/Issues.gif" ALIGN=Bottom></A><BR>
|
|
|
|
<A REL=COPYRIGHT HREF="../Front/Help.htm#Legal"><I>Copyright 1996-2005, LispWorks Ltd. All rights reserved.</I></A><P>
|
|
</BODY>
|
|
</HTML>
|