Vista Junctions and Java Folder Recursion

imported_plasmasnake

Junior Member
Aug 28, 2005
17
0
0
For a program I'm writing in Java (1.4), I need to be able to traverse a file system hierarchy. The typical way to do this is to start at a root, use listFiles(), and for each file in the returned array that returns true on isDirectory() recurse. Unfortunately, while this works great in *nix and Windows pre-Vista, Vista's new symbolic links/junction points present a bit of a challenge (OK, so Windows has had junction points since 2000 or so, but they've never posed a problem like this before). The major problem is, "Documents and Settings" still exists in Vista; it's a junction point for Users, and while you can access Documents and Settings\%username%, Documents and Settings itself cannot be accessed. The really bizarre thing is, it passes both as a directory and as readable (I check .isDirectory() and .canRead()). In *nix, you can compare the absolute path and canonical path to ensure you only access "real" folders, but in Vista, those two are equivalent for junction points anyway. What I've been left to is calling .listFiles() on all potential folders, and checking if the result is null. While this seems to work, I'd prefer not to have to put up with that overhead if possible. Google has failed me on this matter, so I seek AT's expertise. =)

Thanks much!