1
0
Fork 0
cl-sites/novaspec.org/cl/f_pathname.html
2025-02-05 18:52:26 +01:00

382 lines
No EOL
8.3 KiB
HTML

<!DOCTYPE HTML>
<HTML LANG="en-us"
><HEAD
><TITLE
>pathname | Common Lisp Nova Spec</TITLE
><META CHARSET="US-ASCII"
><LINK REL="canonical" HREF="f_pathname.html"
><LINK REL="next" HREF="f_make-pathname.html" TYPE="text/html" TITLE="make-pathname"
><LINK REL="prev" HREF="t_logical-pathname.html" TYPE="text/html" TITLE="logical-pathname"
><LINK REL="up" HREF="19_4_Filenames_Dictionary.html" TYPE="text/html" TITLE="19.4 Filenames Dictionary"
><LINK REL="start" HREF="index.html" TYPE="text/html" TITLE="Common Lisp Nova Spec"
><META NAME="VIEWPORT" CONTENT="width=device-width, initial-scale=1.0"
><LINK REL="STYLESHEET" HREF="dpans.css%3F3909942064.css"
><SCRIPT SRC="dpans.js%3F3909942064"
></SCRIPT
><SCRIPT SRC="apropos.js%3F3909942064"
></SCRIPT
></HEAD
><BODY
><DIV
><DIV CLASS="topnav"
><DIV CLASS="breadcrumb"
><SPAN CLASS="breadcrumb-item"
><A HREF="index.html"
>Common Lisp Nova Spec</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="19_Filenames.html"
>19. Filenames</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="19_4_Filenames_Dictionary.html"
>19.4 Filenames Dictionary</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="f_pathname.html"
>pathname</A
></SPAN
></DIV
><DIV CLASS="apropos"
><DIV CLASS="apropos-io"
><A HREF="t_logical-pathname.html" CLASS="prev"
>&#8592;</A
><SPAN ID="apropos-label"
>Apropos </SPAN
><INPUT ID="apropos" AUTOFOCUS="AUTOFOCUS" PLACEHOLDER="Type here to search" ONINPUT="aproposInput(this);" ONKEYUP="aproposKeyup(event);" ONCHANGE="aproposChange(this);" ONFOCUS="aproposFocus(this);" ONFOCUSOUT="aproposFocusout(this);"
><A HREF="f_make-pathname.html" CLASS="next"
>&#8594;</A
></DIV
><DIV ID="apropos-res"
></DIV
></DIV
></DIV
><DIV CLASS="matter"
><DIV CLASS="com"
><DIV CLASS="begincom"
><HR
><TABLE WIDTH="100%" CELLSPACING="0" CELLPADDING="0"
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" WIDTH="100%" CLASS="name"
><SPAN CLASS="idx" DATA-KIND="idxref" DATA-TERM="pathname"
></SPAN
><B
>pathname</B
></TD
><TD ALIGN="RIGHT" VALIGN="BASELINE" WIDTH="0" NOWRAP="NOWRAP" CLASS="ftype"
><I
>Function</I
></TD
></TR
></TABLE
><HR
></DIV
><UL CLASS="subtoc"
></UL
><DL
><DT
><B
>Syntax</B
></DT
><DD
><P CLASS="j"
><B
>pathname</B
> <SPAN CLASS="cmssi"
>pathspec</SPAN
> <SPAN CLASS="arrow"
>&#8594;</SPAN
> <SPAN CLASS="cmssi"
>pathname</SPAN
></P
></DD
><DT
><B
>Arguments and Values</B
></DT
><DD
><P CLASS="j"
><VAR CLASS="param"
>pathspec</VAR
> &#8212; a <A HREF="26_1_Glossary.html#pathname_designator"
><EM CLASS="term"
>pathname designator</EM
></A
>. </P
><P CLASS="j"
><VAR CLASS="param"
>pathname</VAR
> &#8212; a <A HREF="26_1_Glossary.html#pathname"
><EM CLASS="term"
>pathname</EM
></A
>.</P
></DD
><DT
><B
>Description</B
></DT
><DD
><P CLASS="j"
>Returns the <A HREF="26_1_Glossary.html#pathname"
><EM CLASS="term"
>pathname</EM
></A
> denoted by <VAR CLASS="param"
>pathspec</VAR
>. </P
><P CLASS="j"
>If the <VAR CLASS="param"
>pathspec</VAR
> <A HREF="26_1_Glossary.html#designator"
><EM CLASS="term"
>designator</EM
></A
> is a <A HREF="26_1_Glossary.html#stream"
><EM CLASS="term"
>stream</EM
></A
>, the <A HREF="26_1_Glossary.html#stream"
><EM CLASS="term"
>stream</EM
></A
> can be either open or closed; in both cases, the <A HREF="f_pathname.html" CLASS="funref"
><B
>pathname</B
></A
> returned corresponds to the <A HREF="26_1_Glossary.html#filename"
><EM CLASS="term"
>filename</EM
></A
> used to open the <A HREF="26_1_Glossary.html#file"
><EM CLASS="term"
>file</EM
></A
>. <A HREF="f_pathname.html" CLASS="funref"
><B
>pathname</B
></A
> returns the same <A HREF="26_1_Glossary.html#pathname"
><EM CLASS="term"
>pathname</EM
></A
> for a <A HREF="26_1_Glossary.html#file_stream"
><EM CLASS="term"
>file stream</EM
></A
> after it is closed as it did when it was open. </P
><P CLASS="j"
>If the <VAR CLASS="param"
>pathspec</VAR
> <A HREF="26_1_Glossary.html#designator"
><EM CLASS="term"
>designator</EM
></A
> is a <A HREF="26_1_Glossary.html#file_stream"
><EM CLASS="term"
>file stream</EM
></A
> created by opening a <A HREF="26_1_Glossary.html#logical_pathname"
><EM CLASS="term"
>logical pathname</EM
></A
>, a <A HREF="26_1_Glossary.html#logical_pathname"
><EM CLASS="term"
>logical pathname</EM
></A
> is returned.</P
></DD
><DT
><B
>Examples</B
></DT
><DD
><PRE CLASS="screen"
> ;; 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.
(setq p1 (pathname "test"))
<SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> #P"CHOCOLATE:TEST" ; with case canonicalization (e.g., VMS)
<SPAN CLASS="sp"
><SPAN CLASS="arrow withabove"
><SPAN CLASS="above"
>or </SPAN
>&#8594;</SPAN
></SPAN
> #P"VANILLA:test" ; without case canonicalization (e.g., Unix)
<SPAN CLASS="sp"
><SPAN CLASS="arrow withabove"
><SPAN CLASS="above"
>or </SPAN
>&#8594;</SPAN
></SPAN
> #P"test"
<SPAN CLASS="sp"
><SPAN CLASS="arrow withabove"
><SPAN CLASS="above"
>or </SPAN
>&#8594;</SPAN
></SPAN
> #S(PATHNAME :HOST "STRAWBERRY" :NAME "TEST")
<SPAN CLASS="sp"
><SPAN CLASS="arrow withabove"
><SPAN CLASS="above"
>or </SPAN
>&#8594;</SPAN
></SPAN
> #S(PATHNAME :HOST "BELGIAN-CHOCOLATE" :NAME "test")
(setq p2 (pathname "test"))
<SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> #P"CHOCOLATE:TEST"
<SPAN CLASS="sp"
><SPAN CLASS="arrow withabove"
><SPAN CLASS="above"
>or </SPAN
>&#8594;</SPAN
></SPAN
> #P"VANILLA:test"
<SPAN CLASS="sp"
><SPAN CLASS="arrow withabove"
><SPAN CLASS="above"
>or </SPAN
>&#8594;</SPAN
></SPAN
> #P"test"
<SPAN CLASS="sp"
><SPAN CLASS="arrow withabove"
><SPAN CLASS="above"
>or </SPAN
>&#8594;</SPAN
></SPAN
> #S(PATHNAME :HOST "STRAWBERRY" :NAME "TEST")
<SPAN CLASS="sp"
><SPAN CLASS="arrow withabove"
><SPAN CLASS="above"
>or </SPAN
>&#8594;</SPAN
></SPAN
> #S(PATHNAME :HOST "BELGIAN-CHOCOLATE" :NAME "test")
(pathnamep p1) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> <A HREF="26_1_Glossary.html#true"
><EM CLASS="term"
>true</EM
></A
>
(eq p1 (pathname p1)) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> <A HREF="26_1_Glossary.html#true"
><EM CLASS="term"
>true</EM
></A
>
(eq p1 p2)
<SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> <A HREF="26_1_Glossary.html#true"
><EM CLASS="term"
>true</EM
></A
>
<SPAN CLASS="sp"
><SPAN CLASS="arrow withabove"
><SPAN CLASS="above"
>or </SPAN
>&#8594;</SPAN
></SPAN
> <A HREF="26_1_Glossary.html#false"
><EM CLASS="term"
>false</EM
></A
>
(with-open-file (stream "test" :direction :output)
(pathname stream))
<SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> #P"ORANGE-CHOCOLATE:&gt;Gus&gt;test.lisp.newest"</PRE
></DD
><DT
><B
>See Also</B
></DT
><DD
><P CLASS="j"
><A HREF="t_pathname.html" CLASS="typeref"
><B
>pathname</B
></A
>, <A HREF="t_logical-pathname.html" CLASS="typeref"
><B
>logical-pathname</B
></A
>, <A HREF="20_1_File_System_Concepts.html#sec_20_1" CLASS="secref"
><SPAN CLASS="cmr"
>Section</SPAN
> <SPAN CLASS="cmr"
>20.1</SPAN
> <SPAN CLASS="cmr"
>(File</SPAN
> <SPAN CLASS="cmr"
>System</SPAN
> <SPAN CLASS="cmr"
>Concepts)</SPAN
></A
>, <A HREF="19_1_Overview_of_Filenames.html#sec_19_1_2" CLASS="secref"
><SPAN CLASS="cmr"
>Section</SPAN
> <SPAN CLASS="cmr"
>19.1.2</SPAN
> <SPAN CLASS="cmr"
>(Pathnames</SPAN
> <SPAN CLASS="cmr"
>as</SPAN
> <SPAN CLASS="cmr"
>Filenames)</SPAN
></A
></P
></DD
></DL
></DIV
></DIV
><DIV CLASS="footer"
><DIV CLASS="btmnav"
><A HREF="t_logical-pathname.html" CLASS="prev"
>&#8592;</A
><A HREF="f_make-pathname.html" CLASS="next"
>&#8594;</A
></DIV
><DIV CLASS="trail"
>Conversion to HTML copyright 2023 by Gilbert Baumann</DIV
></DIV
></DIV
><SCRIPT
>domReady();</SCRIPT
></BODY
></HTML
>