Use .apply on the Configuration.enabledFeatures mutable map

This commit is contained in:
Username404 2021-05-19 20:27:42 +02:00
parent 1106b8bdae
commit 772e665904
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 5 additions and 3 deletions

View File

@ -70,9 +70,11 @@ object Configuration {
writeConfig(it) writeConfig(it)
} }
} }
val enabledFeatures: MutableMap<String, Boolean> = if (obtained.hasPath("enabledFeatures")) { val enabledFeatures = mutableMapOf<String, Boolean>().apply {
obtained.extract("enabledFeatures") if (obtained.hasPath("enabledFeatures")) {
} else mutableMapOf() putAll(obtained.extract("enabledFeatures"))
}
}
val macros: MutableSet<Macro> = run { val macros: MutableSet<Macro> = run {
if (!macroFile.exists()) macroFile.createNewFile() if (!macroFile.exists()) macroFile.createNewFile()
macroFile.readLines(Charset.forName("UTF-8")).map { macroFile.readLines(Charset.forName("UTF-8")).map {