Of course I should have written<div><br></div><div><div>UnixFileDirectory default directoryExists: UnixFileDirectory default fullName, '/.'</div><div><br></div><div>But same problem applies...</div><br><div class="gmail_quote">
On Thu, Dec 15, 2011 at 2:19 PM, Eliot Miranda <span dir="ltr"><<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi All,<div><br></div><div> just noticed that</div><div><br></div><div> UnixFileDirectory default directoryExists: UnixFileDirectory default asString, '/.'</div><div><br></div><div>answers false, since directoryNames excludes '.' and '..' (justifiable, and changing this might break all manner of things). i.e.</div>
<div><br></div><div>FileDirectory>directoryExists: filenameOrPath</div><div><span style="white-space:pre-wrap">        </span>"Answer true if a directory of the given name exists. The given name may be either a full path name or a local directory within this directory."</div>
<div><span style="white-space:pre-wrap">        </span>"FileDirectory default directoryExists: FileDirectory default pathName"</div><div><br></div><div><span style="white-space:pre-wrap">        </span>| fName dir |</div>
<div><span style="white-space:pre-wrap">        </span>DirectoryClass splitName: filenameOrPath to:</div><div><span style="white-space:pre-wrap">                </span>[:filePath :name |</div><div><span style="white-space:pre-wrap">                        </span>fName := name.</div>
<div><span style="white-space:pre-wrap">                        </span>filePath isEmpty</div><div><span style="white-space:pre-wrap">                                </span>ifTrue: [dir := self]</div><div><span style="white-space:pre-wrap">                                </span>ifFalse: [dir := self directoryNamed: filePath]].</div>
<div><br></div><div><span style="white-space:pre-wrap">        </span>^dir exists and: [</div><div><span style="white-space:pre-wrap">                </span>self isCaseSensitive </div><div><span style="white-space:pre-wrap">                        </span>ifTrue:[dir directoryNames includes: fName]</div>
<div><span style="white-space:pre-wrap">                        </span>ifFalse:[dir directoryNames anySatisfy: [:name| name sameAs: fName]]].</div><div><br></div><div><br></div><div>So how about</div><div><br></div><div>FileDirectory class methods for accessing</div>
<div>currentDirectoryNickname</div><div> ^'.'</div><div><br></div><div><div>FileDirectory>directoryExists: filenameOrPath</div><div><span style="white-space:pre-wrap">        </span>"Answer true if a directory of the given name exists. The given name may be either a full path name or a local directory within this directory."</div>
<div><span style="white-space:pre-wrap">        </span>"FileDirectory default directoryExists: FileDirectory default pathName"</div><div><br></div><div><span style="white-space:pre-wrap">        </span>| fName dir |</div>
<div><span style="white-space:pre-wrap">        </span>DirectoryClass splitName: filenameOrPath to:</div><div><span style="white-space:pre-wrap">                </span>[:filePath :name |</div><div><span style="white-space:pre-wrap">                        </span>fName := name.</div>
<div><span style="white-space:pre-wrap">                        </span>filePath isEmpty</div><div><span style="white-space:pre-wrap">                                </span>ifTrue: [dir := self]</div><div><span style="white-space:pre-wrap">                                </span>ifFalse: [dir := self directoryNamed: filePath]].</div>
<div><br></div><div><span style="white-space:pre-wrap">        </span>^dir exists</div><div><span style="white-space:pre-wrap">        </span>and: [fName = self class currentDirectoryNickname</div><div>
<span style="white-space:pre-wrap">        </span><span style="white-space:pre-wrap">        </span>or: [self isCaseSensitive </div><div><span style="white-space:pre-wrap">                        </span>ifTrue:[dir directoryNames includes: fName]</div>
<div><span style="white-space:pre-wrap">                        </span>ifFalse:[dir directoryNames anySatisfy: [:name| name sameAs: fName]]]]</div><div><br></div><font color="#888888">-- <br>best,<div>Eliot</div><br>
</font></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div><br>
</div>