[squeak-dev] The Trunk: Files-fbs.124.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu Jun 27 19:42:08 UTC 2013
Frank Shearar uploaded a new version of Files to project The Trunk:
http://source.squeak.org/trunk/Files-fbs.124.mcz
==================== Summary ====================
Name: Files-fbs.124
Author: fbs
Time: 27 June 2013, 5:18:49.925 pm
UUID: db8086ca-e21b-9748-a401-0430a5641821
Ancestors: Files-tpr.123
Remove the Cursor >> #showWhile because this method has no senders (it's an example of how to recursively enumerate a FileDirectory) and so needlessly introduces a dependency on Graphics.
The diff is very noisy because we unindent the block.
=============== Diff against Files-tpr.123 ===============
Item was changed:
----- Method: FileDirectory>>statsForDirectoryTree: (in category 'enumeration') -----
statsForDirectoryTree: rootedPathName
"Return the size statistics for the entire directory tree starting at the given root. The result is a three element array of the form: (<number of folders><number of files><total bytes in all files>). This method also serves as an example of how recursively enumerate a directory tree."
"FileDirectory default statsForDirectoryTree: '\smalltalk'"
+ | dirs files bytes todo entries p |
+ dirs := files := bytes := 0.
+ todo := OrderedCollection with: rootedPathName.
+ [todo isEmpty] whileFalse: [
+ p := todo removeFirst.
+ entries := self directoryContentsFor: p.
+ entries do: [:entry |
+ entry isDirectory
+ ifTrue: [
+ todo addLast: p , self pathNameDelimiter asString , entry name.
+ dirs := dirs + 1]
+ ifFalse: [
+ files := files + 1.
+ bytes := bytes + entry fileSize]]].
+ ^ Array with: dirs with: files with: bytes
- ^Cursor wait showWhile: [
- | dirs files bytes todo entries p |
- dirs := files := bytes := 0.
- todo := OrderedCollection with: rootedPathName.
- [todo isEmpty] whileFalse: [
- p := todo removeFirst.
- entries := self directoryContentsFor: p.
- entries do: [:entry |
- entry isDirectory
- ifTrue: [
- todo addLast: p , self pathNameDelimiter asString , entry name.
- dirs := dirs + 1]
- ifFalse: [
- files := files + 1.
- bytes := bytes + entry fileSize]]].
- Array with: dirs with: files with: bytes]
!
More information about the Squeak-dev
mailing list
|