How do I avoid symlinks using an Ant FileSet?
- by Will
I have a directory tree that includes a symlink to . (the current directory). When I attempt to iterate over this using an Ant FileSet, I get the following error:
Caught error while checking for symbolic links
at org.apache.tools.ant.DirectoryScanner.causesIllegalSymlinkLoop(DirectoryScanner.java:1859)
The code that I am using to generate the scanner is:
FileSet files = new FileSet();
Project project = new Project();
project.setBasedir( dir );
files.setProject( project );
files.setDir( project.getBaseDir() );
files.getDirectoryScanner().setFollowSymlinks( false );
for( Iterator iter = files.iterator(); iter.hasNext(); ) {}