Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Check local.properties for sdk.dir

  • Loading branch information...
commit ab68dc480c8584b4eccbb66141969747bf68cf37 1 parent 428542f
@jberkel authored
Showing with 16 additions and 5 deletions.
  1. +16 −5 src/main/scala/AndroidPath.scala
View
21 src/main/scala/AndroidPath.scala
@@ -17,10 +17,21 @@ object AndroidPath {
idlPath <<= (platformToolsPath, aidlName) (_ / _),
dxPath <<= (platformToolsPath, osDxName) (_ / _),
- sdkPath <<= (envs) { es =>
- determineAndroidSdkPath(es).getOrElse(sys.error(
- "Android SDK not found. You might need to set %s".format(es.mkString(" or "))
- ))
+ sdkPath <<= (envs, baseDirectory) { (es, dir) =>
+ determineAndroidSdkPath(es).getOrElse {
+ val local = new File(dir, "local.properties")
+ if (local.exists()) {
+ (for (sdkDir <- (for (l <- IO.readLines(local);
+ if (l.startsWith("sdk.dir")))
+ yield l.substring(l.indexOf('=')+1)))
+ yield new File(sdkDir)).headOption.getOrElse(
+ sys.error("local.properties did not contain sdk.dir")
+ )
+ } else sys.error(
+ "Android SDK not found. You might need to set %s".format(es.mkString(" or "))
+ )
+ }
}
- ) }
+ )
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.