protected void gatherAbsolutePaths(String absPath, List<String> list) { File file = new File(absPath); if (file.exists()) { if (file.isFile()) { list.add(absPath); } else if (file.isDirectory()) { // get all of the children String[] childDocumentPaths = file.list(); for (int i = 0; i < childDocumentPaths.length; i++) { String childAbsPath = absPath + File.separatorChar + childDocumentPaths[i]; gatherAbsolutePaths(childAbsPath, list); } } } }
protected void gatherAbsolutePaths(String absPath, List<String> list) { File file = new File(absPath); if (file.exists()) { if (file.isFile()) { list.add(absPath); } else if (file.isDirectory()) { // get all of the children String[] childDocumentPaths = file.list(); for (int i = 0; i < childDocumentPaths.length; i++) { String childAbsPath = absPath + File.separatorChar + childDocumentPaths[i]; gatherAbsolutePaths(childAbsPath, list); } } } }
public String[] getAllDocumentPaths() { List<String> list = new ArrayList<String>(256); // exhaustive traverse of absolute paths gatherAbsolutePaths(getRootDir().getAbsolutePath(), list); // convert to array String[] array = list.toArray(new String[list.size()]); // down shift to relative paths String absRootPath = getRootDir().getAbsolutePath() + File.separatorChar; int absRootPathLen = absRootPath.length(); for (int i = 0; i < array.length; i++) { array[i] = array[i].substring(absRootPathLen); // so as to be consistent with expected store syntax array[i] = array[i].replace("\\", "/"); } return array; }
public String[] getAllDocumentPaths() { List<String> list = new ArrayList<String>(256); // exhaustive traverse of absolute paths gatherAbsolutePaths(getRootDir().getAbsolutePath(), list); // convert to array String[] array = list.toArray(new String[list.size()]); // down shift to relative paths String absRootPath = getRootDir().getAbsolutePath() + File.separatorChar; int absRootPathLen = absRootPath.length(); for (int i = 0; i < array.length; i++) { array[i] = array[i].substring(absRootPathLen); // so as to be consistent with expected store syntax array[i] = array[i].replace("\\", "/"); } return array; }