private static Path getMatchingPath(Map<Path, ArrayList<String>> pathToAliases, Path dir) { // First find the path to be searched Path path = dir; if (foundAlias(pathToAliases, path)) { return path; } Path dirPath = Path.getPathWithoutSchemeAndAuthority(dir); if (foundAlias(pathToAliases, dirPath)) { return dirPath; } while (path!=null && dirPath!=null) { path=path.getParent(); dirPath=dirPath.getParent(); //first try full match if (foundAlias(pathToAliases, path)) { return path; } if (foundAlias(pathToAliases, dirPath)) { return dirPath; } } return null; }
private static Path getMatchingPath(Map<Path, ArrayList<String>> pathToAliases, Path dir) { // First find the path to be searched Path path = dir; if (foundAlias(pathToAliases, path)) { return path; } Path dirPath = Path.getPathWithoutSchemeAndAuthority(dir); if (foundAlias(pathToAliases, dirPath)) { return dirPath; } while (path!=null && dirPath!=null) { path=path.getParent(); dirPath=dirPath.getParent(); //first try full match if (foundAlias(pathToAliases, path)) { return path; } if (foundAlias(pathToAliases, dirPath)) { return dirPath; } } return null; }
private static String getMatchingPath(Map<String, ArrayList<String>> pathToAliases, Path dir) { // First find the path to be searched String path = dir.toString(); if (foundAlias(pathToAliases, path)) { return path; } String dirPath = dir.toUri().getPath(); if (foundAlias(pathToAliases, dirPath)) { return dirPath; } path = dirPath; String dirStr = dir.toString(); int dirPathIndex = dirPath.lastIndexOf(File.separator); int dirStrIndex = dirStr.lastIndexOf(File.separator); while (dirPathIndex >= 0 && dirStrIndex >= 0) { dirStr = dirStr.substring(0, dirStrIndex); dirPath = dirPath.substring(0, dirPathIndex); //first try full match if (foundAlias(pathToAliases, dirStr)) { return dirStr; } if (foundAlias(pathToAliases, dirPath)) { return dirPath; } dirPathIndex = dirPath.lastIndexOf(File.separator); dirStrIndex = dirStr.lastIndexOf(File.separator); } return null; }
if (foundAlias(pathToAliases, path)) { return path; if (foundAlias(pathToAliases, dirPath)) { return dirPath; dirPath = dirPath.substring(0, dirPathIndex); if (foundAlias(pathToAliases, dirStr)) { return dirStr; if (foundAlias(pathToAliases, dirPath)) { return dirPath;