Make Configuration.obtained a lazy property

This commit is contained in:
Username404 2021-05-22 16:25:52 +02:00
parent d028baa5d5
commit d33622b850
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 2 additions and 3 deletions

View File

@ -38,8 +38,7 @@ object Configuration {
) )
} }
} }
@JvmField val obtained: Config by lazy {
val obtained: Config = run {
var result: Config = empty() var result: Config = empty()
with(file) { with(file) {
if (!exists()) { if (!exists()) {
@ -64,7 +63,7 @@ object Configuration {
).extract<Config>("Snowy") ).extract<Config>("Snowy")
}.also { }.also {
runBlocking { runBlocking {
writeConfig(it) writeConfig(it.value)
} }
} }
val enabledFeatures = mutableMapOf<String, Boolean>().apply { val enabledFeatures = mutableMapOf<String, Boolean>().apply {