[Pharo-project] The Magic of FileSystem

Sean P. DeNigris sean at clipperadams.com
Tue Jun 19 09:19:41 EDT 2012

    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.



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