tweak to fix for windows line ending (\r\n) parse errors

This commit is contained in:
Irmen de Jong 2021-04-05 01:49:52 +02:00
parent 61d1f1ea87
commit 0032235933

View File

@ -41,7 +41,7 @@ class ModuleImporter {
if(!Files.isReadable(filePath))
throw ParsingFailedError("No such file: $filePath")
val content = Files.readAllBytes(filePath).toString(Charsets.UTF_8).replace("\r\n", "\n")
val content = filePath.toFile().readText().replace("\r\n", "\n")
return importModule(program, CharStreams.fromString(content), filePath, false, encoder, compilationTargetName)
}
@ -122,7 +122,7 @@ class ModuleImporter {
val (resource, resourcePath) = rsc
resource.use {
println("importing '$moduleName' (library)")
val content = it.readAllBytes().toString(Charsets.UTF_8).replace("\r\n", "\n")
val content = it.reader().readText().replace("\r\n", "\n")
importModule(program, CharStreams.fromString(content), Paths.get("@embedded@/$resourcePath"),
true, encoder, compilationTargetName)
}