mirror of
https://github.com/packwiz/packwiz-installer.git
synced 2025-04-19 13:06:30 +02:00
Fix invalidation issues when changing --side without updating pack
This commit is contained in:
parent
b2421cfea7
commit
c9543f74ee
@ -127,8 +127,11 @@ class UpdateManager internal constructor(private val opts: Options, val ui: IUse
|
|||||||
|
|
||||||
ui.submitProgress(InstallProgress("Checking local files..."))
|
ui.submitProgress(InstallProgress("Checking local files..."))
|
||||||
|
|
||||||
// Invalidation checking must be done here, as it must happen before pack/index hashes are checked
|
// If the side changes, invalidate EVERYTHING (even when the index hasn't changed)
|
||||||
|
val invalidateAll = opts.side != manifest.cachedSide
|
||||||
val invalidatedUris: MutableList<PackwizFilePath> = ArrayList()
|
val invalidatedUris: MutableList<PackwizFilePath> = ArrayList()
|
||||||
|
if (!invalidateAll) {
|
||||||
|
// Invalidation checking must be done here, as it must happen before pack/index hashes are checked
|
||||||
for ((fileUri, file) in manifest.cachedFiles) {
|
for ((fileUri, file) in manifest.cachedFiles) {
|
||||||
// ignore onlyOtherSide files
|
// ignore onlyOtherSide files
|
||||||
if (file.onlyOtherSide) {
|
if (file.onlyOtherSide) {
|
||||||
@ -163,6 +166,7 @@ class UpdateManager internal constructor(private val opts: Options, val ui: IUse
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Log.info("Modpack name: ${pf.name}")
|
Log.info("Modpack name: ${pf.name}")
|
||||||
|
|
||||||
@ -177,6 +181,7 @@ class UpdateManager internal constructor(private val opts: Options, val ui: IUse
|
|||||||
pf.index.hashFormat,
|
pf.index.hashFormat,
|
||||||
manifest,
|
manifest,
|
||||||
invalidatedUris,
|
invalidatedUris,
|
||||||
|
invalidateAll,
|
||||||
clientHolder
|
clientHolder
|
||||||
)
|
)
|
||||||
} catch (e1: Exception) {
|
} catch (e1: Exception) {
|
||||||
@ -202,7 +207,8 @@ class UpdateManager internal constructor(private val opts: Options, val ui: IUse
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun processIndex(indexUri: PackwizPath<*>, indexHash: Hash<*>, hashFormat: HashFormat<*>, manifest: ManifestFile, invalidatedFiles: List<PackwizFilePath>, clientHolder: ClientHolder) {
|
private fun processIndex(indexUri: PackwizPath<*>, indexHash: Hash<*>, hashFormat: HashFormat<*>, manifest: ManifestFile, invalidatedFiles: List<PackwizFilePath>, invalidateAll: Boolean, clientHolder: ClientHolder) {
|
||||||
|
if (!invalidateAll) {
|
||||||
if (manifest.indexFileHash == indexHash && invalidatedFiles.isEmpty()) {
|
if (manifest.indexFileHash == indexHash && invalidatedFiles.isEmpty()) {
|
||||||
ui.submitProgress(InstallProgress("Modpack files are already up to date!", 1, 1))
|
ui.submitProgress(InstallProgress("Modpack files are already up to date!", 1, 1))
|
||||||
if (manifest.cachedFiles.any { it.value.isOptional }) {
|
if (manifest.cachedFiles.any { it.value.isOptional }) {
|
||||||
@ -216,6 +222,7 @@ class UpdateManager internal constructor(private val opts: Options, val ui: IUse
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
manifest.indexFileHash = indexHash
|
manifest.indexFileHash = indexHash
|
||||||
|
|
||||||
val indexFileSource = try {
|
val indexFileSource = try {
|
||||||
@ -281,9 +288,6 @@ class UpdateManager internal constructor(private val opts: Options, val ui: IUse
|
|||||||
Log.warn("Index is empty!")
|
Log.warn("Index is empty!")
|
||||||
}
|
}
|
||||||
val tasks = createTasksFromIndex(indexFile, opts.side)
|
val tasks = createTasksFromIndex(indexFile, opts.side)
|
||||||
// If the side changes, invalidate EVERYTHING just in case
|
|
||||||
// Might not be needed, but done just to be safe
|
|
||||||
val invalidateAll = opts.side != manifest.cachedSide
|
|
||||||
if (invalidateAll) {
|
if (invalidateAll) {
|
||||||
Log.info("Side changed, invalidating all mods")
|
Log.info("Side changed, invalidating all mods")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user