String (@NotNull final String homeDirectory, @NotNull String name) { File binPath = new File(homeDirectory); File binDir = binPath.getParentFile(); if (binDir == null) return null; VirtualFileSystem localVfs = StandardFileSystems.local(); File runner = new File(binDir, name); if (runner.exists()) return localVfs.extractPresentableUrl(runner.getPath()); runner = new File(new File(binDir, "Scripts"), name); if (runner.exists()) return localVfs.extractPresentableUrl(runner.getPath()); runner = new File(new File(binDir.getParentFile(), "Scripts"), name); if (runner.exists()) return localVfs.extractPresentableUrl(runner.getPath()); runner = new File(new File(binDir.getParentFile(), "local"), name); if (runner.exists()) return localVfs.extractPresentableUrl(runner.getPath()); runner = new File(new File(new File(binDir.getParentFile(), "local"), "bin"), name); if (runner.exists()) return localVfs.extractPresentableUrl(runner.getPath()); // if interpreter is a symlink if (FileSystemUtil.isSymLink(homeDirectory)) { String resolvedPath = FileSystemUtil.resolveSymLink(homeDirectory); if (resolvedPath != null) { return getExecutablePath(resolvedPath, name); } } // Search in standard unix path runner = new File(new File("/usr", "bin"), name); if (runner.exists()) return localVfs.extractPresentableUrl(runner.getPath()); runner = new File(new File(new File("/usr", "local"), "bin"), name); if (runner.exists()) return localVfs.extractPresentableUrl(runner.getPath()); return null; }