System.out.println("Directory: " + dirIx + ", " + relativePath);
int ix = dirIx;
if (parentDir.isDirectory()) {
File[] subDirs = parentDir.listFiles(new DirFilter());
Arrays.sort(subDirs);
JsonDirData dirData;
for (File subDir: subDirs) {
if (!relativePath.endsWith("/")) {
relativePath += "/";
}
dirData = new JsonDirData();
dirData.setDirIx(++ix);
dirData.setPath( relativePath + subDir.getName());
// TODO: make if conditional
dirData.setIsIndexed(true);
dirData.setParentDirIx(dirIx);
allDirectories.add(dirData);
ix = appendSubDirectories(allDirectories, indexedDirectories, subDir, ix, dirData.getPath());
}
}
return ix;
}