public int addPath(String path, boolean rescan) throws IOException {
System.out.println("Adding path to DB " + path);
int probCnt = problems.size();
if (path.endsWith(".sgfi")) {
FileConnection fc = (FileConnection) Connector.open(
"file://localhost/" + path);
readIndex(path, fc.openInputStream(), false);
} else {
rescan |= paths.indexOf(path) < 0;
if (rescan) {
removePath(path);
path = addPath(path);
FileConnection fc = (FileConnection) Connector.open(
"file://localhost/" + path);
if (fc.isDirectory())
addDir(path, fc, path);
else
addProblems(path, null, fc.openInputStream(), false);
}
}
return problems.size() - probCnt;
}