Skip to content

Commit

Permalink
include file hashes when figuring out cache location
Browse files Browse the repository at this point in the history
  • Loading branch information
Zxnii committed Jan 15, 2024
1 parent 5bb789f commit 99a03f1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/kotlin/wtf/zani/launchwrapper/LunarLaunchWrapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ suspend fun main(args: Array<String>) {
return
}

var hashes: List<String>? = null

withContext(Dispatchers.IO) {
launch { version.download(offlineDir) }
launch { hashes = version.download(offlineDir) }
launch { textures.download(textureDir) }
}

Expand Down Expand Up @@ -124,6 +126,8 @@ suspend fun main(args: Array<String>) {

val digest = MessageDigest.getInstance("SHA-256")

hashes!!.forEach { digest.update(it.toByteArray()) }

PrebakeHelper.location = offlineDir.resolve("cache/${toHexString(digest.digest(gameVersion.toByteArray()))}")
PrebakeHelper.location.createDirectories()

Expand Down

0 comments on commit 99a03f1

Please sign in to comment.