[Pharo-project] The Magic of FileSystem
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.
:) 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.
participants (2)
-
Sean P. DeNigris -
Stéphane Ducasse