List<Path> (Path root) { List<Path> binDirs = new ArrayList<>(); Path[] candidates = {root.resolve(BIN_DIRECTORY), Paths.get(getCommunityHomePath(root.toString()), "bin")}; String osSuffix = SystemInfoRt.isWindows ? "win" : SystemInfoRt.isMac ? "mac" : "linux"; for (Path dir : candidates) { if (binDirs.contains(dir) || !Files.isDirectory(dir)) { continue; } binDirs.add(dir); dir = dir.resolve(osSuffix); if (Files.isDirectory(dir)) { binDirs.add(dir); if (SystemInfoRt.isWindows || SystemInfoRt.isLinux) { String arch = CpuArch.isIntel64() ? "amd64" : CpuArch.isArm64() ? "aarch64" : null; if (arch != null) { dir = dir.resolve(arch); if (Files.isDirectory(dir)) { binDirs.add(dir); } } } } } return binDirs; }