Issue 5493 in pharo: FileDirectory >> statsForDirectoryTree: depends on Cursor

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue 5493 in pharo: FileDirectory >> statsForDirectoryTree: depends on Cursor

pharo
Status: Accepted
Owner: [hidden email]
Labels: Type-Cleanup

New issue 5493 by [hidden email]: FileDirectory >>  
statsForDirectoryTree: depends on Cursor
http://code.google.com/p/pharo/issues/detail?id=5493

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."
        "wod 6/16/1998: add Cursor wait, and use 'self pathNameDelimiter asString'  
rather than hardwired ':' "
        "FileDirectory default statsForDirectoryTree: '\smalltalk'"

        | dirs files bytes |
        Cursor wait showWhile: [ | 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 at: 4)
                                        ifTrue: [
                                                todo addLast: (p, self pathNameDelimiter asString, (entry at: 1)).
                                                dirs := dirs + 1]
                                        ifFalse: [
                                                files := files + 1.
                                                bytes := bytes + (entry at: 5)]]]].

        ^ Array with: dirs with: files with: bytes



And it has no senders...


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 5493 in pharo: FileDirectory >> statsForDirectoryTree: depends on Cursor

pharo

Comment #1 on issue 5493 by [hidden email]: FileDirectory >>  
statsForDirectoryTree: depends on Cursor
http://code.google.com/p/pharo/issues/detail?id=5493

We can remove the cursor whileTrue:.... part.




_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 5493 in pharo: FileDirectory >> statsForDirectoryTree: depends on Cursor

pharo
Updates:
        Status: FixToInclude
        Labels: Milestone-2.0

Comment #2 on issue 5493 by [hidden email]: FileDirectory >>  
statsForDirectoryTree: depends on Cursor
http://code.google.com/p/pharo/issues/detail?id=5493

it has no senders is part of the old filesystem --> just delete the method


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 5493 in pharo: FileDirectory >> statsForDirectoryTree: depends on Cursor

pharo
Updates:
        Status: Integrated

Comment #3 on issue 5493 by [hidden email]: FileDirectory >>  
statsForDirectoryTree: depends on Cursor
http://code.google.com/p/pharo/issues/detail?id=5493

in 2.0 050


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker