}
}
// only scan directories that can include matched files or
// directories
for (Map.Entry<TokenizedPath, String> entry : newroots.entrySet()) {
TokenizedPath currentPath = entry.getKey();
String currentelement = currentPath.toString();
if (basedir == null
&& !FileUtils.isAbsolutePath(currentelement)) {
continue;
}
File myfile = new File(basedir, currentelement);
if (myfile.exists()) {
// may be on a case insensitive file system. We want
// the results to show what's really on the disk, so
// we need to double check.
try {
String path = (basedir == null)
? myfile.getCanonicalPath()
: FILE_UTILS.removeLeadingPath(canonBase,
myfile.getCanonicalFile());
if (!path.equals(currentelement) || ON_VMS) {
myfile = currentPath.findFile(basedir, true);
if (myfile != null && basedir != null) {
currentelement = FILE_UTILS.removeLeadingPath(
basedir, myfile);
if (!currentPath.toString()
.equals(currentelement)) {
currentPath =
new TokenizedPath(currentelement);
}
}
}
} catch (IOException ex) {
throw new BuildException(ex);
}
}
if ((myfile == null || !myfile.exists()) && !isCaseSensitive()) {
File f = currentPath.findFile(basedir, false);
if (f != null && f.exists()) {
// adapt currentelement to the case we've
// actually found
currentelement = (basedir == null)
? f.getAbsolutePath()
: FILE_UTILS.removeLeadingPath(basedir, f);
myfile = f;
currentPath = new TokenizedPath(currentelement);
}
}
if (myfile != null && myfile.exists()) {
if (!followSymlinks && currentPath.isSymlink(basedir)) {
accountForNotFollowedSymlink(currentPath, myfile);
continue;
}
if (myfile.isDirectory()) {
if (isIncluded(currentPath)