Always use UTF-8 for reading TOML files (fixes #22)

This commit is contained in:
comp500
2022-05-11 17:45:39 +01:00
parent 07af6046c1
commit 92d6f68f1d
3 changed files with 7 additions and 8 deletions

View File

@@ -9,6 +9,7 @@ import link.infra.packwiz.installer.task.CacheKey
import link.infra.packwiz.installer.task.Task
import link.infra.packwiz.installer.task.TaskCombinedResult
import link.infra.packwiz.installer.task.TaskContext
import java.io.InputStreamReader
class PackwizV1PackTomlTask(ctx: TaskContext, val path: PackwizPath): Task<PackwizV1PackFile>(ctx) {
// TODO: make hierarchically defined by caller? - then changing the pack format type doesn't leave junk in the cache
@@ -30,7 +31,7 @@ class PackwizV1PackTomlTask(ctx: TaskContext, val path: PackwizPath): Task<Packw
private val internalResult by lazy {
// TODO: query, parse JSON
val packFile = Toml().read(path.source(ctx.clients).inputStream()).to(PackFile::class.java)
val packFile = Toml().read(InputStreamReader(path.source(ctx.clients).inputStream(), "UTF-8")).to(PackFile::class.java)
val resolved = PackwizV1PackFile(packFile.name ?: throw RuntimeException("Name required"), // TODO: better exception handling
path.resolve(packFile.index?.file ?: throw RuntimeException("File required")),