How do I avoid symlinks using an Ant FileSet?
Posted
by
Will
on Stack Overflow
See other posts from Stack Overflow
or by Will
Published on 2011-01-06T21:30:00Z
Indexed on
2011/01/07
6:54 UTC
Read the original article
Hit count: 314
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(); ) {}
© Stack Overflow or respective owner