Package tv.hd3g.processlauncher.cmdline
Class ExecutableFinder
- java.lang.Object
-
- tv.hd3g.processlauncher.cmdline.ExecutableFinder
-
public class ExecutableFinder extends Object
It will resolve/find valid executable files in *NIX and valid executable extensions in Windows. On system PATH, classpath, current dir, and local user dir (/bin). ThreadSafe
-
-
Field Summary
Fields Modifier and Type Field Description static List<File>GLOBAL_DECLARED_DIRSunmodifiableList Specified by -Dexecfinder.searchdir=path1;path2... or path1:path2... on *Nix systems.static Predicate<File>isValidDirectoryReturn exists and isDirectory and canReadstatic List<String>WINDOWS_EXEC_EXTENSIONSunmodifiableList
-
Constructor Summary
Constructors Constructor Description ExecutableFinder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExecutableFinderaddLocalPath(String relativeUserHomePath)Put in top priority.ExecutableFinderaddPath(File filePath)Put in top priority.Fileget(String name)Can add .exe to name if OS == Windows and if it's missing.List<File>getFullPath()StringgetFullPathToString()ExecutableFinderregisterExecutable(String name, File fullPath)
-
-
-
Method Detail
-
getFullPathToString
public String getFullPathToString()
-
addLocalPath
public ExecutableFinder addLocalPath(String relativeUserHomePath)
Put in top priority. Path / or \ will be corrected
-
addPath
public ExecutableFinder addPath(File filePath)
Put in top priority.
-
registerExecutable
public ExecutableFinder registerExecutable(String name, File fullPath) throws IOException
- Throws:
IOException
-
get
public File get(String name) throws FileNotFoundException
Can add .exe to name if OS == Windows and if it's missing.- Parameters:
name- can be a simple exec name, or a full path.- Returns:
- never null
- Throws:
FileNotFoundException- if exec don't exists or is not correctly registed.
-
-