[jira] [Commented] (GROOVY-8341) GDK: eachDirRecurse and eachFileRecurse are NOT depth-first

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

[jira] [Commented] (GROOVY-8341) GDK: eachDirRecurse and eachFileRecurse are NOT depth-first

JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/GROOVY-8341?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16201385#comment-16201385 ]

ASF GitHub Bot commented on GROOVY-8341:
----------------------------------------

Github user asfgit closed the pull request at:

    https://github.com/apache/groovy/pull/614


> GDK: eachDirRecurse and eachFileRecurse are NOT depth-first
> -----------------------------------------------------------
>
>                 Key: GROOVY-8341
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8341
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-jdk
>    Affects Versions: 2.4.11
>         Environment: Windows Linux
>            Reporter: Dirk Heinrichs
>            Priority: Minor
>
> The documentation for those two methods states: "Sub-directories are recursively searched in a depth-first fashion." But the result is NOT depth-first, as the following example shows:
> Given a directory tree of {code}/tmp
> |-/foo
> | |-/bar
> |   |-/foo
> |   |-/bar
> |   |-/baz
> |-/baz{code}
> the following simple code {code}#!/usr/bin/groovy
> File rootDir = new File(new URI('file:/tmp/foo'))
> rootDir.eachDirRecurse {
>   println(it)
> }{code}
> gives this result {code}/tmp/foo/bar
> /tmp/foo/bar/baz
> /tmp/foo/bar/foo
> /tmp/foo/bar/bar
> /tmp/foo/baz{code}
> while {code}% find /tmp/foo -depth -type d{code}
> correctly gives {code}/tmp/foo/bar/baz
> /tmp/foo/bar/foo
> /tmp/foo/bar/bar
> /tmp/foo/bar
> /tmp/foo/baz
> /tmp/foo{code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)