[squeak-dev] The Trunk: Tools-cmm.184.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Feb 15 22:14:19 UTC 2010


Chris Muller uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-cmm.184.mcz

==================== Summary ====================

Name: Tools-cmm.184
Author: cmm
Time: 15 February 2010, 4:13:54.2 pm
UUID: e9098933-b332-4069-96bd-9f9be9405aa5
Ancestors: Tools-dtl.183

- Updates for working with new refactored DirectoryEntry, of the Files package.

=============== Diff against Tools-dtl.183 ===============

Item was changed:
  ----- Method: FileList2>>listForPatterns: (in category 'volume list and pattern') -----
  listForPatterns: anArray
  	"Make the list be those file names which match the patterns."
  
  	| sizePad newList |
  	directory ifNil: [^#()].
  	(fileSelectionBlock isKindOf: MessageSend) ifTrue: [
  		fileSelectionBlock arguments: {directory entries}.
  		newList := fileSelectionBlock value.
  		fileSelectionBlock arguments: #().
  	] ifFalse: [
  		newList := Set new.
  		anArray do: [ :pat |
  			newList addAll: (directory entries select: [:entry | fileSelectionBlock value: entry value: pat]) ].
  	].
  	newList := newList asSortedCollection: self sortBlock.
+ 	sizePad := (newList inject: 0 into: [:mx :entry | mx max: entry fileSize])
- 	sizePad := (newList inject: 0 into: [:mx :entry | mx max: (entry at: 5)])
  					asStringWithCommas size - 1.
  	newList := newList collect: [ :e | self fileNameFormattedFrom: e sizePad: sizePad ].
  	^ newList asArray!

Item was changed:
  ----- Method: FileList>>fileNameFormattedFrom:sizePad: (in category 'volume list and pattern') -----
  fileNameFormattedFrom: entry sizePad: sizePad
  	"entry is a 5-element array of the form:
  		(name creationTime modificationTime dirFlag fileSize)"
  	| sizeStr nameStr dateStr |
+ 	nameStr := entry isDirectory
+ 		ifTrue: [entry name , self folderString]
+ 		ifFalse: [entry name].
+ 	dateStr := ((Date fromSeconds: entry modificationTime )
- 	nameStr := (entry at: 4)
- 		ifTrue: [entry first , self folderString]
- 		ifFalse: [entry first].
- 	dateStr := ((Date fromSeconds: (entry at: 3) )
  					printFormat: #(3 2 1 $. 1 1 2)) , ' ' ,
  				(String streamContents: [:s |
+ 					(Time fromSeconds: entry modificationTime \\ 86400)
- 					(Time fromSeconds: (entry at: 3) \\ 86400)
  						print24: true on: s]).
+ 	sizeStr := entry fileSize asStringWithCommas.
- 	sizeStr := (entry at: 5) asStringWithCommas.
  	sortMode = #name ifTrue:
  		[^ nameStr , '    (' , dateStr , ' ' , sizeStr , ')'].
  	sortMode = #date ifTrue:
  		[^ '(' , dateStr , ' ' , sizeStr , ') ' , nameStr].
  	sortMode = #size ifTrue:
  		[^ '(' , ((sizeStr size to: sizePad) collect: [:i | $ ]) , sizeStr , ' ' , dateStr , ') ' , nameStr].
  !

Item was changed:
  ----- Method: FileList>>listForPatterns: (in category 'private') -----
  listForPatterns: anArray
  	"Make the list be those file names which match the pattern."
  
  	| sizePad newList |
  	newList := Set new.
  	anArray do: [ :pat | newList addAll: (self entriesMatching: pat) ].
  	newList := (SortedCollection sortBlock: self sortBlock) addAll: newList; yourself.
+ 	sizePad := (newList inject: 0 into: [:mx :entry | mx max: (entry fileSize)])
- 	sizePad := (newList inject: 0 into: [:mx :entry | mx max: (entry at: 5)])
  					asStringWithCommas size - 1.
  	newList := newList collect: [ :e | self fileNameFormattedFrom: e sizePad: sizePad ].
  
  	volList size = 1 ifTrue:
  		["Include known servers along with other desktop volumes" 
  		^ newList asArray ,
  		(ServerDirectory serverNames collect: [:n | '^' , n , self folderString])].
  	^ newList asArray!




More information about the Squeak-dev mailing list