Don't create token.txt if it already exists

This commit is contained in:
Leith Bade
2015-01-27 11:13:00 +11:00
parent 8193acdf30
commit 7f41d476c1

View File

@@ -4,11 +4,13 @@ task accessToken {
def rawDir = new File("app/src/main/res/raw")
rawDir.mkdirs()
def tokenFile = new File("app/src/main/res/raw/token.txt")
String token = System.getenv('MAPBOX_ACCESS_TOKEN')
if (token == null) {
throw new InvalidUserDataException("You must set the MAPBOX_ACCESS_TOKEN environment variable.")
if (!tokenFile.exists()) {
String token = System.getenv('MAPBOX_ACCESS_TOKEN')
if (token == null) {
throw new InvalidUserDataException("You must set the MAPBOX_ACCESS_TOKEN environment variable.")
}
tokenFile.write(token)
}
tokenFile.write(token)
}
gradle.projectsEvaluated {