[FIX] SMFix

John M McIntosh johnmci at smalltalkconsulting.com
Thu Oct 9 22:20:49 UTC 2003


This fix posted back in June was never considered. Might check it

'From Squeak3.5 of ''11 April 2003'' [latest update: #5180] on 18 June  
2003 at 11:34:11 pm'!
"Change Set:		MacRootPathNameFix-JMM
Date:			18 June 2003
Author:			johnmci at smalltalkconsulting.com

Attempting to open a file 'foobar.txt' on Volume 'fum' will fail, the  
path is fum:foobar.txt. This change set alters MacFileDirectory  
class>>isAbsolute: to consider that fum is a root thus fum:foobat.txt  
is a absolute pathname"!


!MacFileDirectory class methodsFor: 'class initialization' stamp: 'JMM  
6/18/2003 23:33'!
isAbsolute: fileName
	"Return true if the given fileName is absolute. The rules are:

If a path begins with a colon, it is relative.
Otherwise,
   If it contains a colon anywhere, it is absolute and the first  
component is the volume name.
   Otherwise,
     It is absolute because it is a volume name."

	fileName first = $: ifTrue: [^false].
	(fileName includes: $:) ifTrue: [^true].
	(fileName size > 0) ifTrue: [^true].
	^false! !


On Thursday, October 9, 2003, at 10:09  AM, Karl Ramberg wrote:

> Ned Konz wrote:
>>
>> On Thursday 09 October 2003 00:13, karl.ramberg at chello.se wrote:
>>
>>> The use of FileDirectory default can cause some unexpexted behaviour  
>>> on
>>> MacOS classic. Changed to use FileDirectory new instead."!
>>
>> We need to fix the FileDirectory logic for 'default', *not* change  
>> the API.
>>
>> I have worked in this area some, but I don't have a MacOS Classic  
>> environment
>> to test with. (Well, maybe I do on the ancient Powerbook; does the  
>> 9.2 that
>> comes with Mac OS/X work OK if you boot from it?).
>>
>> There has been long discussion (and many 'fixes') about the meaning  
>> and
>> interpretation of relative paths on the Mac.
>>
>> Please, let's get this logic working right rather than changing the  
>> usage!
>
> Well, looked at this more carefully and found this
> (Note all entries are directories.)
> FileDirectory default fullNameFor: 'Video:Squeak3.6a:sm' =>
> 'Video:Squeak3.6a:sm' "works"
> FileDirectory default fullNameFor: 'Video:Squeak3.6a' =>
> 'Video:Squeak3.6a:Video:Squeak3.6a' "error!!!"
>
>
> FileDirectory activeDirectoryClass splitName: fileName to:
> 		[:filePath :localName |
> 			correctedLocalName _ localName isEmpty
> 				ifFalse: [self checkName: localName fixErrors: true]
> 				ifTrue: [localName].
> 			prefix _ self fullPathFor: filePath].
>
> First the fileName is split to filePath := Video and localName :=  
> Squeak3.6a
> Then when prefix _ self fullPathFor: filePath is sent prefix will
> resolve to
> 'Video:Squeak3.6a:Video'
>
> But if I send prefix _ self fullPathFor: 'Video:' it will answer  
> 'Video:'
>
> So should the fix be a MacFileDirectory>>splitName:to: that answers the
> filePath with delimiter when the path answers only the drive name ?
>
> Anybody got a suggestion ?
>
> Karl
>
>
>
--
======================================================================== 
===
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
======================================================================== 
===



More information about the Squeak-dev mailing list