public CloudSdkVersion getVersion ( ) throws CloudSdkVersionFileException { Path versionFile = getPath ( ) . resolve ( VERSION_FILE_NAME ) ; if ( ! Files . isRegularFile ( versionFile ) ) { throw new CloudSdkVersionFileNotFoundException ( "Cloud SDK version file not found at " + versionFile . toString ( ) ) ; } String contents = "" ; try { List < String > lines = Files . readAllLines ( versionFile , StandardCharsets . UTF_8 ) ; if ( lines . size ( ) > 0 ) { // expect only a single line contents = lines . get ( 0 ) ; } return new CloudSdkVersion ( contents ) ; } catch ( IOException ex ) { throw new CloudSdkVersionFileException ( ex ) ; } catch ( IllegalArgumentException ex ) { throw new CloudSdkVersionFileParseException ( "Pattern found in the Cloud SDK version file could not be parsed: " + contents , ex ) ; } }
Returns the version of the Cloud SDK installation . Version is determined by reading the VERSION file located in the Cloud SDK directory .