Skip to content

Commit

Permalink
force config file to be created in utf-8 and without bom
Browse files Browse the repository at this point in the history
  • Loading branch information
aviramha committed Nov 30, 2023
1 parent fe59049 commit 684217f
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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")

Expand Down Expand Up @@ -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()) }
}
}

0 comments on commit 684217f

Please sign in to comment.