<div dir="ltr">Hi Tobias,<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, May 11, 2014 at 9:59 AM, Tobias Pape <span dir="ltr"><<a href="mailto:Das.Linux@gmx.de" target="_blank">Das.Linux@gmx.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hey,<br>
<div><br>
On 11.05.2014, at 16:54, <a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a> wrote:<br>
<br>
> Not least this finesses the issue of having a case-sensitive<br>
> file system on Mac OS (which is an option).<br>
<br>
</div>For the puzzled, what is the problem here?<br></blockquote><div><br></div><div>The old code looks like</div><div><br></div><div>FileDirectory>>includesKey: localName</div><div><span style="white-space:pre-wrap">        </span>"Answer true if this directory includes a file or directory of the given name. Note that the name should be a local file name, in contrast with fileExists:, which takes either local or full-qualified file names."</div>
<div><span style="white-space:pre-wrap">        </span>"(FileDirectory on: Smalltalk vmPath) includesKey: 'SqueakV2.sources'"</div><div><span style="white-space:pre-wrap">        </span>self isCaseSensitive</div>
<div><span style="white-space:pre-wrap">                </span>ifTrue:[^ self fileAndDirectoryNames includes: localName]</div><div><span style="white-space:pre-wrap">                </span>ifFalse:[^ self fileAndDirectoryNames anySatisfy: [:str| str sameAs: localName]]. </div>
</div><br><br>which a) is slow because it uses fileAndDirectoryNames, and b) will give the wrong answer on case-sensitive Mac OS file systems when there are different files/directories with the same name ignoring case. b) is the real problem because it can lead to loss of data (albeit rarely).</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">The new code is:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra">FileDirectory>>includesKey: localName</div><div class="gmail_extra">
<span style="white-space:pre-wrap">        </span>"Answer true if this directory includes a file or directory of the given name. Note that the name should be a local file name, in contrast with fileExists:, which takes either local or full-qualified file names."</div>
<div class="gmail_extra"><span style="white-space:pre-wrap">        </span>"(FileDirectory on: Smalltalk vmPath) includesKey: 'SqueakV2.sources'"</div><div class="gmail_extra"><span style="white-space:pre-wrap">        </span>^(self directoryEntryForName: localName) notNil</div>
<div><br></div><div>which goes straight to the stat system call via the FilePlugin's primitive and so a) avoids creating DirectoryEntry instances for all entries, and b) gets the right answer when there are different files/directories with the same name ignoring case.</div>
-- <br>best,<div>Eliot</div>
</div></div>