Skip to content

Commit

Permalink
Version Check Fix from horixon
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Rose committed Mar 3, 2011
1 parent 9fa9943 commit 89079e8
Showing 1 changed file with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,29 @@ private double getVersion()
versionArgument.setValue("-version");

task.execute();
double version = parseAdtVersionNumber( getProject().getProperty(outputProperty) );
LoggingUtil.log("Found AIR version: " + version);
return version;
}

//Parse version number and return as int
String output = getProject().getProperty(outputProperty);
int prefixIndex = output.indexOf("adt version \"");
double version = Double.parseDouble(output.substring(prefixIndex + 13, prefixIndex + 16));

LoggingUtil.log("Found AIR version: " + version);
private double parseAdtVersionNumber( String versionString )
{
double version;

return version;
//AIR 2.6 and greater only returns the version number.
if( versionString.startsWith("adt") )
{
//Parse version number and return as int
int prefixIndex = versionString.indexOf("adt version \"");
version = Double.parseDouble(versionString.substring(prefixIndex + 13, prefixIndex + 16));

}else
{
version = Double.parseDouble(versionString.substring(0, 3) );
}

return version;
}

@Override
Expand Down

0 comments on commit 89079e8

Please sign in to comment.