views:

13

answers:

0

I'm using commons-vfs to traverse down folder hierarchies. As an example:

/foo
    /test.jar

If I use the locator

file:///foo

I can successfully find the child

file:///foo/test.jar

However, if I try to descend into it, via FileObject.getChildren(), it says that there are no children. By prepending the jar: schema, things work fine:

if (child.getName().getExtension().equals("jar"))
    child = VFS.getManager().resolveFile("jar:" + child.getURL());

but this doesn't feel like the correct solution to me. Something more like child.reopenWithSchema("jar") or perhaps a static FileSystemManager method...

Is there any better way to do this than URL manipulation? Even better, autodiscover that it's an archive and use the appropriate schema for access?