in appengine-plugins-core/src/main/java/com/google/cloud/tools/managedcloudsdk/ManagedCloudSdk.java [74:104]
public boolean isInstalled()
throws ManagedSdkVerificationException, ManagedSdkVersionMismatchException {
if (getSdkHome() == null) {
return false;
}
if (!Files.isDirectory(getSdkHome())) {
return false;
}
if (!Files.isRegularFile(getGcloudPath())) {
return false;
}
// Verify the versions match up for fixed version installs
if (version != Version.LATEST) {
try {
String versionFileContents =
new String(Files.readAllBytes(getSdkHome().resolve("VERSION")), StandardCharsets.UTF_8)
.trim();
if (!versionFileContents.equals(version.getVersion())) {
throw new ManagedSdkVersionMismatchException(
"Installed sdk version: "
+ versionFileContents
+ " does not match expected version: "
+ version.getVersion()
+ ".");
}
} catch (IOException ex) {
throw new ManagedSdkVerificationException(ex);
}
}
return true;
}