Skip to content

Commit

Permalink
force config file to be created in utf-8 and without bom (#205)
Browse files Browse the repository at this point in the history
* force config file to be created in utf-8 and without bom

* towncrier
  • Loading branch information
aviramha authored Nov 30, 2023
1 parent fe59049 commit b951b80
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.d/204.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Change default configuration to explicitly avoid setting BOM, fixing potential issue on some systems
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 b951b80

Please sign in to comment.