From 684217f46d59546e1760b37d657ff2b50e6f9bea Mon Sep 17 00:00:00 2001 From: Aviram Hassan Date: Thu, 30 Nov 2023 12:22:53 +0200 Subject: [PATCH] force config file to be created in utf-8 and without bom --- .../main/kotlin/com/metalbear/mirrord/MirrordConfigAPI.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordConfigAPI.kt b/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordConfigAPI.kt index 2de67d9f..d5e9f186 100644 --- a/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordConfigAPI.kt +++ b/modules/core/src/main/kotlin/com/metalbear/mirrord/MirrordConfigAPI.kt @@ -4,6 +4,7 @@ import com.google.gson.Gson import com.intellij.notification.NotificationType import com.intellij.openapi.project.Project import com.intellij.openapi.vfs.VirtualFile +import java.nio.charset.Charset /** * For detecting mirrord config specified in run configuration. @@ -20,8 +21,7 @@ private const val DEFAULT_CONFIG = "fs": "read", "env": true } -} -""" +}""" class InvalidConfigException(path: String, reason: String) : MirrordError("failed to process config $path - $reason") @@ -134,6 +134,8 @@ class MirrordConfigAPI(private val service: MirrordProjectService) { val mirrordDir = getMirrordDir() ?: getMirrordDirParent().createChildDirectory(this, ".mirrord") return mirrordDir.createChildData(this, "mirrord.json") + .apply { bom = null } + .apply { charset = Charset.forName("UTF-8") } .apply { setBinaryContent(DEFAULT_CONFIG.toByteArray()) } } }