fix(gog): installs no longer hang on Finishing for large games (#2367)

* fix(gog): list each folder once when checking install paths

The case-clash check listed a file's parent folder again for every file, so installing a game with thousands of files stayed on Finishing for a very long time after the download.

* fix(gog): check each install path prefix once instead of resolving every file
This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-11-11 20:55:48 -05:00
1 parent 8e02be2440
commit c177b1eed1
2 files changed
+28 -8

No files matched your search

@@ -302,10 +302,17 @@ class GogMaintenanceTest {
File(folder, "Game.bin").writeText("original")
assertThrows(IllegalArgumentException::class.java) { GogFiles.validate(JSONArray("""[{"path":"game.bin"}]"""), folder) }
assertThrows(IllegalArgumentException::class.java) { GogFiles.validate(JSONArray("""[{"path":".droiddeck-store.json"}]"""), folder) }
val data = File(folder, "Data").apply { mkdirs() }
val installed = JSONArray()
for (i in 0 until 2000) { File(data, "Part$i.bin").writeText(""); installed.put(JSONObject().put("path", "Data/Part$i.bin")) }
GogFiles.validate(installed, folder)
assertThrows(IllegalArgumentException::class.java) { GogFiles.validate(JSONArray("""[{"path":"Data/Part0.bin"},{"path":"Data/part1.bin"}]"""), folder) }
val outside = temporary.newFolder()
try { Files.createSymbolicLink(File(folder, "link").toPath(), outside.toPath()) }
catch (_: java.nio.file.FileSystemException) { return }
assertThrows(IllegalArgumentException::class.java) { GogFiles.inside(folder, "link/game.exe") }
assertThrows(IllegalArgumentException::class.java) { GogFiles.validate(JSONArray("""[{"path":"Data/Part0.bin"},{"path":"link/game.exe"}]"""), folder) }
assertThrows(IllegalArgumentException::class.java) { GogFiles.validate(JSONArray("""[{"path":"a/./file"}]"""), folder) }
}
@Test fun resumedInstallSpaceCountsOnlyFilesStillMissing() {