<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Chapter 12. Files</title><link rel="stylesheet" href="ecl.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="The ECL manual"><link rel="up" href="pt01.html" title="Part I. Standards"><link rel="prev" href="ch11s02.html" title="11.2. Wild pathnames and matching"><link rel="next" href="ch12s02.html" title="12.2. Dictionary"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 12. Files</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch11s02.html">Prev</a> </td><th width="60%" align="center">Part I. Standards</th><td width="20%" align="right"> <a accesskey="n" href="ch12s02.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 12. Files"><div class="titlepage"><div><div><h2 class="title"><a name="sec.ansi.files"></a>Chapter 12. Files</h2></div></div></div><div class="toc"><dl><dt><span class="section"><a href="ch12.html#sec.ansi.resolving">12.1. Mapping pathnames to files</a></span></dt><dt><span class="section"><a href="ch12s02.html">12.2. Dictionary</a></span></dt><dd><dl><dt><span class="section"><a href="ch12s02.html#sec.ansi.files.directory">12.2.1. <code class="function">DIRECTORY</code></a></span></dt></dl></dd></dl></div><div class="section" title="12.1. Mapping pathnames to files"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sec.ansi.resolving"></a>12.1. Mapping pathnames to files</h2></div></div></div><p>Pathnames are used to represent files in a storage device<sup>[<a name="id2573740" href="#ftn.id2573740" class="footnote">1</a>]</sup>. However, before using a pathname to perform a filesystem operation, <span class="application">ECL</span> will have to apply a number of transformations to it. First of all, if the pathname is a logical one it has to be converted to a physical pathname. Second, this physical pathname must not be a relative one, it has to be converted into an absolute pathname.</p><p>The convertion of a relative pathname into an absolute one is performed automatically by many Common Lisp functions. The overall procedure consists on merging the pathname with the value of <code class="varname">*default-pathname-defaults*</code>.</p><p>A problem with this approach is that many Lisp programs are not prepared to have <code class="varname">*default-pathname-defaults*</code> pointing to an actual directory. Also, additional to the maintaining value of this variable, programs have to take care of the notion of the "current working directory" as understood by the operating system. Finally the variable <code class="varname">*default-pathname-defaults*</code> influences not only the resolution of relative pathnames, but also many other functions (<code class="function">MAKE-PATHNAME</code>, <code class="function">MERGE-PATHNAMES</code>, etc), what makes its use complicated.</p><p>The approach followed by <span class="application">ECL</span> is to set <code class="varname">*default-pathname-defaults*</code> to a pathname with all elements set to NIL, <code class="code">(MAKE-PATHNAME :NAME NIL :TYPE NIL ...)</code>. Then, every physical pathname which is to be converted to an absolute one is first merged with the value of <code class="varname">*default-pathname-defaults*</code> and afterwards with the pathname with the output of <code class="function">SI:GETCWD</code>, which returns the current working directory as understood by the operating system.</p></div><div class="footnotes"><br><hr width="100" align="left"><div class="footnote"><p><sup>[<a name="ftn.id2573740" href="#id2573740" class="para">1</a>] </sup>Actually, the <span class="application">ECL</span> syntax allows physical pathnames to represent any <acronym class="acronym">URL</acronym>.</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch11s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="pt01.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch12s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">11.2. Wild pathnames and matching </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 12.2. Dictionary</td></tr></table></div></body></html>