mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 00:17:11 -07:00
Warnings.
This commit is contained in:
parent
2227783905
commit
91bb1b955c
1 changed files with 5 additions and 2 deletions
|
@ -6,6 +6,9 @@ import java.nio.file.Files
|
||||||
import java.nio.file.Paths
|
import java.nio.file.Paths
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encapsulate read access to local.properties.
|
||||||
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
class LocalProperties {
|
class LocalProperties {
|
||||||
val localProperties: Properties by lazy {
|
val localProperties: Properties by lazy {
|
||||||
|
@ -22,11 +25,11 @@ class LocalProperties {
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getNoThrows(name: String, docUrl: String? = null) = localProperties.getProperty(name)
|
fun getNoThrows(name: String, docUrl: String? = null): String? = localProperties.getProperty(name, docUrl)
|
||||||
|
|
||||||
fun get(name: String, docUrl: String? = null) : String {
|
fun get(name: String, docUrl: String? = null) : String {
|
||||||
val result = getNoThrows(name, docUrl)
|
val result = getNoThrows(name, docUrl)
|
||||||
?: throw KobaltException("Couldn't find $name in local.properties", docUrl = docUrl)
|
?: throw KobaltException("Couldn't find $name in local.properties", docUrl = docUrl)
|
||||||
return result as String
|
return result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue