Java Code Examples for org.gradle.internal.os.OperatingSystem#getExecutableName()

The following examples show how to use org.gradle.internal.os.OperatingSystem#getExecutableName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ToolSearchPath.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private File findExecutable(OperatingSystem operatingSystem, String name) {
    List<File> path = pathEntries.isEmpty() ? operatingSystem.getPath() : pathEntries;
    String exeName = operatingSystem.getExecutableName(name);
    try {
        if (name.contains(File.separator)) {
            return maybeResolveFile(operatingSystem, new File(name), new File(exeName));
        }
        for (File pathEntry : path) {
            File resolved = maybeResolveFile(operatingSystem, new File(pathEntry, name), new File(pathEntry, exeName));
            if (resolved != null) {
                return resolved;
            }
        }
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }

    return null;
}
 
Example 2
Source File: ToolSearchPath.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private File findExecutable(OperatingSystem operatingSystem, String name) {
    List<File> path = pathEntries.isEmpty() ? operatingSystem.getPath() : pathEntries;
    String exeName = operatingSystem.getExecutableName(name);
    try {
        if (name.contains(File.separator)) {
            return maybeResolveFile(operatingSystem, new File(name), new File(exeName));
        }
        for (File pathEntry : path) {
            File resolved = maybeResolveFile(operatingSystem, new File(pathEntry, name), new File(pathEntry, exeName));
            if (resolved != null) {
                return resolved;
            }
        }
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }

    return null;
}
 
Example 3
Source File: ToolSearchPath.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
protected File findExecutable(OperatingSystem operatingSystem, String name) {
    if (!pathEntries.isEmpty()) {
        String exeName = operatingSystem.getExecutableName(name);
        for (File pathEntry : pathEntries) {
            File candidate = new File(pathEntry, exeName);
            if (candidate.isFile()) {
                return candidate;
            }
        }
        return null;
    } else {
        return operatingSystem.findInPath(name);
    }
}
 
Example 4
Source File: ToolSearchPath.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
protected File findExecutable(OperatingSystem operatingSystem, String name) {
    if (!pathEntries.isEmpty()) {
        String exeName = operatingSystem.getExecutableName(name);
        for (File pathEntry : pathEntries) {
            File candidate = new File(pathEntry, exeName);
            if (candidate.isFile()) {
                return candidate;
            }
        }
        return null;
    } else {
        return operatingSystem.findInPath(name);
    }
}