You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Elliotte Rusty Harold (Jira)" <ji...@apache.org> on 2024/02/04 13:32:00 UTC

[jira] [Commented] (IO-364) Allow DirectoryWalker provide relative paths in handle*()

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

Elliotte Rusty Harold commented on IO-364:
------------------------------------------

I did something like this while working on copyDirectory. This would have some problems. I think we'd need to pass a root file path down through the various walk/handle methods so it would be new API. Also, with Java 8+ and Paths.relativize in the JDK it's no longer hard to subtract one path from another, so I recommend closing this one as Won't Do.

> Allow DirectoryWalker provide relative paths in handle*()
> ---------------------------------------------------------
>
>                 Key: IO-364
>                 URL: https://issues.apache.org/jira/browse/IO-364
>             Project: Commons IO
>          Issue Type: Improvement
>          Components: Utilities
>    Affects Versions: 2.4
>            Reporter: Ondra Žižka
>            Priority: Major
>
> {code}
> handleFile( File file, int depth, Collection results )
> {code}
> and other methods provide a file object with full path.
> As it's much easier to concat base path and additional path than "substracting" one path from other, I suggest:
> The `File` object provided by `handleFile()` and other `handle*` methods should (optionally) contain path relative to the one passed to `walk()`.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)