Use the IO coroutines dispatcher in Configuration.kt

This commit is contained in:
Username404 2021-06-05 22:54:13 +02:00
parent 7eb4cdf69a
commit 546a4d118e
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 2 additions and 1 deletions

View File

@ -12,6 +12,7 @@ import fr.username404.snowygui.gui.feature.Category
import fr.username404.snowygui.gui.feature.Macro
import io.github.config4k.extract
import io.github.config4k.getValue
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
@ -52,7 +53,7 @@ object Configuration {
private val configDirectory: String = (Minecraft.getInstance().gameDirectory.absolutePath + File.separator + "config").also { File(it).mkdir() }
private val file: File = File(configDirectory + File.separator + "snowy.conf")
private suspend fun writeConfig(c: Config) = coroutineScope {
launch {
launch(Dispatchers.IO) {
file.writeText(
"""
|Snowy {