[Pharo-project] FileDirectory default is wrong in MacOS
Mariano Martinez Peck
marianopeck at gmail.com
Mon Nov 22 00:44:59 CET 2010
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). 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
But anyway, why MacFileDirectory class >> isActiveDirectoryClass answers
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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pharo-project