List of utility methods to do File Find
String | findExe(String exeName, String... path) Find the executable with the given name by checking the directories in the given path in order. for (String dir : path) { File f = new File(dir + "/" + exeName); if (f.exists()) { return f.getPath(); return null; |
File | findExecutable(File baseLocation) find Executable File plugins = new File(baseLocation, "features"); FilenameFilter filter = new FilenameFilter() { public boolean accept(File dir, String name) { return name.startsWith("org.eclipse.equinox.executable"); }; String[] files = plugins.list(filter); if (files != null && files.length > 0) ... |
File | findExecutable(String executableName) find Executable String systemPath = System.getenv("PATH"); String[] pathDirs = systemPath.split(File.pathSeparator); File fullyQualifiedExecutable = null; for (String pathDir : pathDirs) { File file = new File(pathDir, executableName); if (file.isFile() && file.canExecute()) { fullyQualifiedExecutable = file; break; ... |
File | findExecutableInDirectory(String executable, File directory) Tries to find the given executable (specified by its name) in the given directory. if (directory == null || !directory.isDirectory()) { return null; for (String extension : EXECUTABLE_EXTENSIONS) { File file = new File(directory, executable + extension); if (file.isFile() && file.canExecute()) { return file; return null; |
File | findExecutableInPath(String exec) find Executable In Path List<String> candidates = new ArrayList<String>(); candidates.add(exec); candidates.add(exec + ".exe"); candidates.add(exec + ".bat"); candidates.add(exec + ".cmd"); candidates.add(exec + ".sh"); candidates.add(exec + ".bash"); String systemPath = System.getenv("PATH"); ... |
File | findExecutableInSystemPath(String executable) Tries to find the given executable (specified by its name) in the system's path. String systemPath = System.getenv("PATH"); if (systemPath == null) { return null; String[] pathDirs = systemPath.split(File.pathSeparator); for (String pathDir : pathDirs) { File dir = new File(pathDir); if (dir.isDirectory()) { ... |
String | findExecutableLocation(String executableName) find Executable Location return findExecutableLocation(executableName, new String[] {}); |
String | findExecutableOnPath(String executable) Checks the system path for the provided executable. if (executable.contains(File.separator)) return executable; String systemPath = System.getenv("PATH"); if (systemPath == null) systemPath = System.getenv("path"); if (systemPath == null || File.pathSeparator == null) return executable; String[] pathDirs = systemPath.split(File.pathSeparator); ... |
File | findExecutableOnPath(String executableName) Find an executable based on given name from the PATH. String systemPath = System.getenv("PATH"); String[] pathDirs = systemPath.split(File.pathSeparator); return findExecutableOnPath(executableName, pathDirs); |
File | findExecutableOnPath(String executableName) Tries to find the given executable on the path File fullyQualifiedExecutable = null; fullyQualifiedExecutable = new File(expandPath(executableName)); if (fullyQualifiedExecutable.isFile()) { return fullyQualifiedExecutable; String systemPath = System.getenv("PATH"); String[] pathDirs = systemPath.split(File.pathSeparator); for (String pathDir : pathDirs) { ... |