diff --git a/src/main/kotlin/link/infra/packwiz/installer/UpdateManager.kt b/src/main/kotlin/link/infra/packwiz/installer/UpdateManager.kt index bc92b36..6c2bb58 100644 --- a/src/main/kotlin/link/infra/packwiz/installer/UpdateManager.kt +++ b/src/main/kotlin/link/infra/packwiz/installer/UpdateManager.kt @@ -22,10 +22,7 @@ import link.infra.packwiz.installer.ui.data.InstallProgress import link.infra.packwiz.installer.util.Log import link.infra.packwiz.installer.util.ifletOrErr import okio.buffer -import java.io.FileNotFoundException -import java.io.FileReader -import java.io.FileWriter -import java.io.IOException +import java.io.* import java.nio.file.Files import java.nio.file.Paths import java.util.concurrent.CompletionService @@ -88,7 +85,7 @@ class UpdateManager internal constructor(private val opts: Options, val ui: IUse } val pf = packFileSource.buffer().use { try { - Toml().read(it.inputStream()).to(PackFile::class.java) + Toml().read(InputStreamReader(it.inputStream(), "UTF-8")).to(PackFile::class.java) } catch (e: IllegalStateException) { ui.showErrorAndExit("Failed to parse pack.toml", e) } @@ -201,7 +198,7 @@ class UpdateManager internal constructor(private val opts: Options, val ui: IUse } val indexFile = try { - Toml().read(indexFileSource.buffer().inputStream()).to(IndexFile::class.java) + Toml().read(InputStreamReader(indexFileSource.buffer().inputStream(), "UTF-8")).to(IndexFile::class.java) } catch (e: IllegalStateException) { ui.showErrorAndExit("Failed to parse index file", e) } diff --git a/src/main/kotlin/link/infra/packwiz/installer/metadata/IndexFile.kt b/src/main/kotlin/link/infra/packwiz/installer/metadata/IndexFile.kt index 14acfef..3c76f9b 100644 --- a/src/main/kotlin/link/infra/packwiz/installer/metadata/IndexFile.kt +++ b/src/main/kotlin/link/infra/packwiz/installer/metadata/IndexFile.kt @@ -9,6 +9,7 @@ import link.infra.packwiz.installer.request.HandlerManager.getFileSource import link.infra.packwiz.installer.request.HandlerManager.getNewLoc import okio.Source import okio.buffer +import java.io.InputStreamReader import java.nio.file.Paths class IndexFile { @@ -43,7 +44,7 @@ class IndexFile { linkedFileURI = getNewLoc(indexUri, file) val src = getFileSource(linkedFileURI!!) val fileStream = getHasher(hashFormat!!).getHashingSource(src) - linkedFile = Toml().read(fileStream.buffer().inputStream()).to(ModFile::class.java) + linkedFile = Toml().read(InputStreamReader(fileStream.buffer().inputStream(), "UTF-8")).to(ModFile::class.java) if (!fileStream.hashIsEqual(fileHash)) { throw Exception("Invalid mod file hash") } diff --git a/src/main/kotlin/link/infra/packwiz/installer/task/formats/packwizv1/PackwizV1PackTomlTask.kt b/src/main/kotlin/link/infra/packwiz/installer/task/formats/packwizv1/PackwizV1PackTomlTask.kt index 846a4e9..0fe18a8 100644 --- a/src/main/kotlin/link/infra/packwiz/installer/task/formats/packwizv1/PackwizV1PackTomlTask.kt +++ b/src/main/kotlin/link/infra/packwiz/installer/task/formats/packwizv1/PackwizV1PackTomlTask.kt @@ -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(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