public final class ExecutablePathUtils extends Object
Modifier and Type | Method and Description |
---|---|
static File |
detectExecutableOnPath(String executableName)
Detects the executable home directory and validates that it matches the required pattern using
existsInHomeBinExePattern(String, String) |
static boolean |
existsInHomeBinExePattern(String homePath,
String executableName)
Validates that the executable exists at the path ${homePath}/bin/${executableName}
Appends ".bat" to the executable name if the platform is Windows
|
static File |
findExecutable(String executableName,
com.google.common.base.Predicate<File> validityPredicate,
String envHomeDir,
List<String> fhsHomes)
This method will return the executable home path, searching first in environment home, then on PATH, finally in a
FHS - compliant directory.
|
static File |
findExecutable(String executableName,
com.google.common.base.Predicate<File> validityPredicate,
String envHomeDir,
String fhsHome)
This method will return the executable home path, searching first in environment home, then on PATH, finally in a
FHS - compliant directory.
|
static String |
findExecutablePath(String executableName)
Finds the path of the executable given its name.
|
static Optional<File> |
getExistingExecutable(String basePath,
String executableName) |
static File |
getHomeFromExecutableInHomeBin(File executable)
Gets the home directory for an executable if its parent directory is 'bin'
|
static String |
makeBatchIfOnWindows(String builder) |
public static boolean existsInHomeBinExePattern(@Nullable String homePath, @NotNull String executableName)
homePath
- executableName
- public static Optional<File> getExistingExecutable(@Nullable String basePath, @NotNull String executableName)
@Nullable public static File detectExecutableOnPath(@NotNull String executableName)
existsInHomeBinExePattern(String, String)
executableName
- of the builder executable@Nullable public static File getHomeFromExecutableInHomeBin(@NotNull File executable)
executable
- the executable file used to detect the home directory@Nullable public static File findExecutable(@NotNull String executableName, @Nullable com.google.common.base.Predicate<File> validityPredicate, @Nullable String envHomeDir, @Nullable String fhsHome)
executableName
- executable name to search forvalidityPredicate
- predicate used to validate the executable pathenvHomeDir
- home directory from environmentfhsHome
- FHS-compliant home directory@Nullable public static File findExecutable(@NotNull String executableName, @Nullable com.google.common.base.Predicate<File> validityPredicate, @Nullable String envHomeDir, @NotNull List<String> fhsHomes)
executableName
- executable name to search forvalidityPredicate
- predicate used to validate the executable pathenvHomeDir
- home directory from environmentfhsHomes
- FHS-compliant home directoryCopyright © 2021 Atlassian Software Systems Pty Ltd. All rights reserved.