Initialize the SourcePath File array, which will contain only the
directory names from the given path string.
if (pathstr == null || pathstr.length() == 0) {
pathstr = ".";
}
int noOfFileSep = 0;
int index = 0;
this.pathstr = pathstr; // Save original class path string
// Count the number of path separators
while ((index = pathstr.indexOf(dirSeparator, index)) != -1) {
noOfFileSep++;
index++;
}
// Build the source path
File[] tempPath = new File[noOfFileSep + 1];
int tempPathIndex = 0;
int len = pathstr.length();
int sepPos;
for (index = 0; index < len; index = sepPos + 1) {
sepPos = pathstr.indexOf(dirSeparator, index);
if (sepPos < 0) {
sepPos = len;
}
File file = new File(pathstr.substring(index, sepPos));
if (file.isDirectory()) {
tempPath[tempPathIndex++] = file;
} // if it is really a file, ignore it.
}
sourcePath = new File[tempPathIndex];
System.arraycopy((Object)tempPath, 0, (Object)sourcePath,
0, tempPathIndex);