ok, again, it is mainly operating-system "native" but it would be nice to have anyway!
At a minimum, it would be nice if available returned true for symlinks. Why can't it be treated like just another file?
>> Why can't it be treated like just another file? Because java.io.File#isSymbolicFile() does not exist. So symbolic files that point to directories are treated as directories (java.io.File#isDirectory() returns true), symbolic files that point to non-existant files are treats as not present (java.io.File#exists() returns false)
However we do have org.apache.tools.ant.util.FileUtils.isSymbolicLink(File, String). This is what is used in the <symlink> task. There are a number of caveats to using it as noted in the javadoc: * <p>It doesn't really test for symbolic links but whether the * canonical and absolute paths of the file are identical - this * may lead to false positives on some platforms.</p> However, the platform on which this gives a false positive has not (to my knowledge) been found yet. I would say that this version of available is possible, but should carry the same caveat until sun actually does provide a better interface to native file systems, and then we can drop in a reflection to use a real test when the proper vm is available. I might try to code this up if I have time this weekend, but no guarantees and of course any1 who wants to do it or be sure it gets done is free to beat me to it. :)
see also Bug 22370 one option is just to always delete and recreate the symlink with http://ant.apache.org/manual/OptionalTasks/symlink.html not really beautiful, but may be a work-around for some situations where one would test as RFE'd here
symlink selector is available in Ant 1.10