@@ -9,6 +9,7 @@ import com.intellij.openapi.application.WriteAction
99import com.intellij.openapi.extensions.PluginId
1010import com.intellij.openapi.fileChooser.FileChooserFactory
1111import com.intellij.openapi.fileChooser.FileSaverDescriptor
12+ import com.intellij.openapi.util.text.StringUtil
1213import com.intellij.openapi.vfs.VirtualFile
1314import com.intellij.openapi.vfs.VirtualFileWrapper
1415import com.intellij.ui.JBColor
@@ -70,13 +71,17 @@ internal class DefaultTokensFileExportPanel
7071 return
7172 }
7273
73- // When exporting to a file, we also need to add the JSON schema reference
74- val jsonStr = getResourceAsStream(" /defaults/${CC .File .Defaults } " ).bufferedReader().use(Reader ::readText)
74+ // When exporting to a file, we also need to add the JSON schema reference.
75+ // Better normalize line endings to \n.
76+ val jsonStr = StringUtil .convertLineSeparators(
77+ getResourceAsStream(" /defaults/${CC .File .Defaults } " ).bufferedReader().use(Reader ::readText)
78+ )
79+
7580 val pluginVersion = getPluginVersion()
7681 val schemaPath = " src/main/resources/defaults/conventionalcommit.schema.json"
7782 val schemaUrl = " https://github.com/lppedd/idea-conventional-commit/raw/$pluginVersion /$schemaPath "
7883 val sb = StringBuilder (jsonStr)
79- sb.insert(4 , $$" \" $schema \" : \" $$schemaUrl \" ,\n " )
84+ sb.insert(4 , $$" \" $schema \" : \" $$schemaUrl \" ,\n " )
8085
8186 WriteAction .runAndWait<Throwable > {
8287 virtualFile.setBinaryContent(" $sb " .toByteArray())
0 commit comments