1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -07:00

Warnings.

This commit is contained in:
Cedric Beust 2017-03-01 10:12:46 -08:00
parent 446901283d
commit f10749adae

View file

@ -10,16 +10,17 @@ public class Versions {
/**
* Turn "6.9.4" into 600090004
*/
public fun toLongVersion(version: String) : Long {
fun toLongVersion(version: String) : Long {
val count = version.countChar('.')
val normalizedVersion = if (count == 2) version else if (count == 1) version + ".0"
val normalizedVersion =
if (count == 2) version else if (count == 1) version + ".0"
else version + ".0.0"
fun parseLong(s: String, radix: Int) : Long {
try {
return java.lang.Long.parseLong(s, radix)
} catch(ex: NumberFormatException) {
warn("Couldn't parse version \"${version}\"")
warn("Couldn't parse version \"$version\"")
return 0L
}
}