Deleting symbolic links via the java.nio.file.Path API
Alan.Bateman at oracle.com
Sat Oct 9 11:51:05 PDT 2010
> My 2 cents is that the exists, notExists, and checkAccess methods
> should have the following signatures:
> void checkAccess(AccessMode modes, LinkOption... options)
> boolean exists(LinkOption... options)
> boolean notExists(LinkOption... options)
> This would add convenience by enabling the programmer to avoid
> accessing file attributes (and handling an IOException) just to
> determine if something exists on the file system that corresponds to a
> java.nio.file.Path instance.
There may be a case where you want to check if a file exists without
following links, but I'm not sure that it really make sense for
checkAccess. What does it mean for a sym link to be writable or
executable for example. In the native world, there isn't an laccess so
it's not something that native code can readily do either (it can
simulate it but there may be subtle differences).
One thing I should say is that checkAccess does need to be re-examined
(we have a bug tracking this) so I'll add it to the list of things to
look at (for the exists case anyway).
More information about the nio-dev