Since DirectoryEntry already implements #fileSize, it wouldn't be too
crazy to also implement:
directorySize
"total size of the entry, if it's a directory"
^ 0
so that way wouldn't need to create a new sender of the type-check
(in DirectoryEntryDirectory>>directorySize)..
On Mon, Mar 28, 2016 at 6:07 AM, <
[hidden email]> wrote:
> Marcel Taeumel uploaded a new version of Files to project The Trunk:
>
http://source.squeak.org/trunk/Files-mt.150.mcz>
> ==================== Summary ====================
>
> Name: Files-mt.150
> Author: mt
> Time: 28 March 2016, 1:07:09.732818 pm
> UUID: 4273cc14-a856-48f1-bfb4-eeb600da1b8b
> Ancestors: Files-cmm.149
>
> Adds method to calculate size of directory including all its subdirectories. Complements #fileSize and #fileSizeString.
>
> =============== Diff against Files-cmm.149 ===============
>
> Item was added:
> + ----- Method: DirectoryEntry>>directorySize (in category 'access') -----
> + directorySize
> + "Size of all files in that directory and all its sub-directories."
> +
> + ^ 0!
>
> Item was added:
> + ----- Method: DirectoryEntry>>directorySizeString (in category 'access') -----
> + directorySizeString
> +
> + ^ self directorySize asBytesDescription
> + !
>
> Item was added:
> + ----- Method: DirectoryEntryDirectory>>directorySize (in category 'access') -----
> + directorySize
> +
> + ^ self asFileDirectory entries
> + inject: 0
> + into: [:sum :entry | sum + (entry isDirectory ifTrue: [entry directorySize] ifFalse: [entry fileSize])]!
>
>