commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ondra Žižka (JIRA) <j...@apache.org>
Subject [jira] [Commented] (IO-364) Allow DirectoryWalker provide relative paths in handle*()
Date Wed, 30 Jan 2013 19:07:15 GMT

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

Ondra Žižka commented on IO-364:
--------------------------------

Workaround:

{code}
        new DirectoryWalker( null, new SuffixFileFilter(".texy"), -1){
            File dirToScan;

            @Override protected void handleFile( File file, int depth, Collection results
) throws IOException {
                String rel = dirToScan.toURI().relativize(file.toURI()).getPath();
                File relativePath = new File(rel);
                addDocToIndexIfNotExists( relativePath );
            }

            public void scan( File dirToScan ) throws IOException {
                List results = new ArrayList();
                this.dirToScan = dirToScan;
                walk( dirToScan, results );
            }
        }.scan( dirToScan );
{code}
                
> Allow DirectoryWalker provide relative paths in handle*()
> ---------------------------------------------------------
>
>                 Key: IO-364
>                 URL: https://issues.apache.org/jira/browse/IO-364
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 2.4
>            Reporter: Ondra Žižka
>
> {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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message