I hope the following is understandable.
In the scandir method of DirectoryScanner, the code looks like this for
directories:
if (isIncluded(name)) {
if (!isExcluded(name)) {
dirsIncluded.addElement(name);
if (fast) {
scandir(file, name+File.separator, fast);
}
} else {
dirsExcluded.addElement(name);
}
} else {
dirsNotIncluded.addElement(name);
if (fast && couldHoldIncluded(name)) {
scandir(file, name+File.separator, fast);
}
}
However, I'd like to use the following xml in my build.xml file:
<AnalyzeRequest debug="yes" srcdir="${src}">
<include name="*.cfm"/>
<exclude name="images"/>
</AnalyzeRequest>
I feel the above exclude should work, but it doesn't because if IsExcluded
test only occurs inside the IsIncluded test.
My solution was to wrap the whole above if statement with:
if (isExcluded(name)) {
dirsExcluded.addElement(name);
}
else {
... the original if statement
... move the scandir call here so that
... we don't recurse through excluded directories.
}
Comments? Is this a change that should find its way into the main code
base?