//There is at least one file/dir in this directory.
FThenDArray aFTD = new FThenDArray(aSubFiles);
//Get all sub-files/dirs...START
VWObject acoSubDirs = new VWObject();
VWObject acoSubFiles = new VWObject();
DirFile df = null;
String sRelDirForSub = null;
if(aFTD.hasMoreFiles() || aFTD.hasMoreDirs()) {
if(getRelDir().length() < 1) {
sRelDirForSub = sES;
} else {
sRelDirForSub = getRelDir() + File.separator;
}
sRelDirForSub += getFileObjThis().getName();
}
//First: Process all sub-files.
while(aFTD.hasMoreFiles()) {
File fFile = aFTD.getNextFile();
//This is a file.
//A what? A file. A what? A file. Oh, a file.
o_utputter.writeNoln(".");
//The final "null" parameter is the FileFilter. We're
//definitely not going to analyze sub-files (files don't
//*have* sub-files!), so there's no need to provide a
//FileFilter.
df = new DirFile(getFileObjBaseDir(), sRelDirForSub, fFile, getLevelsToAnalyze(), (getLevelsBelowBaseDir() + 1), null, o_utputter);
acoSubFiles.add(df);
}
//All sub-files have been processed.
//Second, process all sub-directories.
while(aFTD.hasMoreDirs()) {
File fDir = aFTD.getNextDir();
//Do we need to analyze the contents of this
//directory?
int iLevelsToAnalyzeInSubObjects = -2;
boolean bNeedToAnalyzeSubDir = false;
if(getLevelsToAnalyze() > 0) {
//We definitely need to analyze at least the
//contents of this directory.
iLevelsToAnalyzeInSubObjects = getLevelsToAnalyze() - 1;
bNeedToAnalyzeSubDir = true;
} else if(getLevelsToAnalyze() == -1) {
//Analyze everything, no matter how deep.
iLevelsToAnalyzeInSubObjects = -1;
bNeedToAnalyzeSubDir = true;
}
if(bNeedToAnalyzeSubDir) {
//We want to analyze this directory. Not
//necessarily it's contents, but definitely *it*.
df = new DirFile(getFileObjBaseDir(), sRelDirForSub, fDir, iLevelsToAnalyzeInSubObjects, (getLevelsBelowBaseDir() + 1), file_filter, o_utputter);
acoSubDirs.add(df);
}
}
//All directories have been processed.
//We now have all the sub-thing-ees. Put them into the
//DirFile arrays.
Object[] ao = acoSubDirs.getAOObject();
adfSubDirectories = new DirFile[ao.length];
for(int i = 0; i < ao.length; i++) {
adfSubDirectories[i] = (DirFile)ao[i];
}
ao = acoSubFiles.getAOObject();
adfSubFiles = new DirFile[ao.length];
for(int i = 0; i < ao.length; i++) {
adfSubFiles[i] = (DirFile)ao[i];
}
//Get all sub-files/dirs...END