[Pharo-project] FileDirectory default is wrong in MacOS

Eliot Miranda eliot.miranda at gmail.com
Mon Nov 22 00:49:19 CET 2010


On Sun, Nov 21, 2010 at 3:44 PM, Mariano Martinez Peck <
marianopeck at gmail.com> wrote:

> Hi. The simplest way to find the problem (if my case it was muuuch more
> than this), I found the following:  MacOS is case insensitive (I've just
> figure it out).


Actually no.  It can be either.  You can choose.  Mine is case-sensitive.



> Since it is a UNIX at the end, I thought it was case sensitive, but it
> seems it is not. Now, suppose that in the directory where my image is, I
> have the file called 'zaraza'. If I evaluate this:
>
> (FileDirectory default fileOrDirectoryExists: 'zaraza')  ->>>> true
>
> I should get true. And the same with:
>
>
> (FileDirectory default fileOrDirectoryExists: 'ZARAZA')  ->>>> false
>
> But....I get false instead of true. Which is wrong in Mac OS.
> The problem is that  FileDirectory default  -----> UnixFileDirectory
>
> And this is because
>
> FileDirectory class >> activeDirectoryClass
>     "Return the concrete FileDirectory subclass for the platform on which
> we are currently running."
>
>     FileDirectory allSubclasses do: [:class |
>         class isActiveDirectoryClass ifTrue: [^ class]].
>
>
> that loop answers UnixFileDirectory. This is because:
>
> nixFileDirectory class >> isActiveDirectoryClass
>     "Does this class claim to be that properly active subclass of
> FileDirectory for this platform?
>     Default test is whether the primPathNameDelimiter matches the one for
> this class. Other tests are possible"
>
>     ^self pathNameDelimiter = self primPathNameDelimiter
>
> answers true.
>
> But anyway, why MacFileDirectory class >> isActiveDirectoryClass  answers
> false?
>
> If we see:
>
> MacFileDirectory class >> isActiveDirectoryClass
>     ^ super isActiveDirectoryClass
>         and: [(Smalltalk getSystemAttribute: 1201) isNil
>                 or: [(Smalltalk getSystemAttribute: 1201) asNumber <= 31]]
>
>
> (Smalltalk getSystemAttribute: 1201    ->   '255'
>
>
> So.....my questions are:
>
> 1) Should it answer Unix one, or MacOS?  I guess than MacOS, and if it is
> unix, then we have to solve the kind of problem I have
> 2) Why (Smalltalk getSystemAttribute: 1201    ->   '255'
> 3) Why not using "Smalltalk platformName" to detect which FileDirectory to
> use??
>
> Thanks
>
> Mariano
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gforge.inria.fr/pipermail/pharo-project/attachments/20101121/c959b46d/attachment.htm>


More information about the Pharo-project mailing list