[Pharo-project] The Magic of FileSystem

Stéphane Ducasse stephane.ducasse at inria.fr
Tue Jun 19 13:00:16 EDT 2012


:)
I want the same with OPAL :)

Stef


> This...
>    localFileName: aString
> 	| dir entry parent fileNameWithoutTrailingSlash |
> 	super localFileName: aString.
> 	parent := FileDirectory default.
> 	
> 	self flag: 'directoryExists: fails if trailing slash. Replace this whole
> mess with FS'.
> 	fileNameWithoutTrailingSlash := fileName last = $/ ifTrue: [ fileName
> allButLast ] ifFalse: [ fileName ].
> 	(parent directoryExists: fileNameWithoutTrailingSlash) ifTrue: [
> 		dir := FileDirectory on: (parent fullNameFor: fileName).
> 		entry := dir directoryEntry.
> 		self modifiedAt: (DateAndTime fromSeconds: entry modificationTime) ].
> 	fileName last = $/ ifFalse: [ fileName := fileName, '/' ].
> (which I *think* had an undiscovered bug, invisible due to the complexity)
> 
> vs. This...
>    localFileName: aString
> 
> 	| file |	
> 	super localFileName: aString.
> 	file := aString asFileReference.	
> 	file exists ifFalse: [ ^ self ].
> 	self modifiedAt: file entry modificationTime.
> 
> Ahhhh...
> 
> Cheers,
> Sean
> 
> --
> View this message in context: http://forum.world.st/The-Magic-of-FileSystem-tp4635471.html
> Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
> 





More information about the Pharo-dev mailing list