From 546a4d118ed102c7bd2c6150b0a24a79fa9c6ef7 Mon Sep 17 00:00:00 2001 From: Username404 Date: Sat, 5 Jun 2021 22:54:13 +0200 Subject: [PATCH] Use the IO coroutines dispatcher in Configuration.kt --- .../kotlin/fr/username404/snowygui/config/Configuration.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt b/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt index f046253..c76dca5 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt @@ -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 {