Compare commits

..

2 Commits

Author SHA1 Message Date
comp500
a8f8444d45 Fix handling of old packwiz.json files with negative murmur2 values 2022-07-18 16:40:39 +01:00
comp500
d98baaf832 Change manifest file back to packwiz.json 2022-07-17 14:26:46 +01:00
2 changed files with 9 additions and 2 deletions

View File

@@ -101,7 +101,7 @@ class Main(args: Array<String>) {
cmd.getOptionValue("multimc-folder")?.let{ PackwizFilePath(it.toPath()) } ?: PackwizFilePath("..".toPath())
}
val manifestFile = ui.wrap("Invalid manifest file path") {
packFolder / (cmd.getOptionValue("meta-file") ?: "manifest.json")
packFolder / (cmd.getOptionValue("meta-file") ?: "packwiz.json")
}
// Start update process!

View File

@@ -21,7 +21,14 @@ data class Hash<T>(val type: HashFormat<T>, val value: T) {
object UInt: Encoding<kotlin.UInt> {
override fun encodeToString(value: kotlin.UInt) = value.toString()
override fun decodeFromString(str: String) = str.toUInt()
override fun decodeFromString(str: String) =
try {
str.toUInt()
} catch (e: NumberFormatException) {
// Old packwiz.json values are signed; if they are negative they should be parsed as signed integers
// and reinterpreted as unsigned integers
str.toInt().toUInt()
}
}
}