[squeak-dev] The Trunk: Files-tpr.123.mcz

Levente Uzonyi leves at elte.hu
Sat Jun 22 12:11:31 UTC 2013


On Sat, 22 Jun 2013, commits at source.squeak.org wrote:

> tim Rowledge uploaded a new version of Files to project The Trunk:
> http://source.squeak.org/trunk/Files-tpr.123.mcz
>
> ==================== Summary ====================
>
> Name: Files-tpr.123
> Author: tpr
> Time: 21 June 2013, 5:40:33.465 pm
> UUID: b3983780-394c-464b-8924-b70282415bfe
> Ancestors: Files-fbs.122
>
> Fix bug reported in mantis ttp://bugs.squeak.org/view.php?id=7740
> FileTestUrl should now pass
>
> =============== Diff against Files-fbs.122 ===============
>
> Item was changed:
>  ----- Method: AcornFileDirectory>>pathParts (in category 'path access') -----
>  pathParts
>  	"Return the path from the root of the file system to this directory as an
>  	array of directory names.
>  	This version tries to cope with the RISC OS' strange filename formatting;
>  	filesystem::discname/$/path/to/file
>  	where the $ needs to be considered part of the filingsystem-discname atom."
>  	| pathList |
>  	pathList := super pathParts.
>  	(pathList indexOf: '$') = 2
>  		ifTrue: ["if the second atom is root ($) then stick $ on the first atom
>  				and drop the second. Yuck"
> + 			^ pathList species

If pathList is always an OrderedCollection (which is true), then 
#streamContents: is not needed. If it's always a new object (which is 
also true), then there's no need to copy it. So I think the following 
would be better:

pathParts

 	| pathList |
 	pathList := super pathParts.
 	(pathList at: 2 ifAbsent: [ nil ]) = '$' ifTrue: [
 		pathList addFirst: pathList removeFirst, self slash, pathList removeFirst ].
 	^pathList

I can't test it, so it's up to you. I removed the comments, but they should be kept.


Levente

> - 			^ Array
>  				streamContents: [:a |
>  					a nextPut: (pathList at: 1), '/$'.
>  					3 to: pathList size do: [:i | a
>  								nextPut: (pathList at: i)]]].
>  	^ pathList!
>
>
>


More information about the Squeak-dev mailing list