Stop walking SD card libraries on every session start and game launch (#2533)

* Stop searching whole libraries on every game launch and session start

The install script search ran over every library whenever any game's
manifest changed, and again on each launch. It now runs per game, only
when that game's build changes, and a launch that names its scripts
does no search at all.

A store game's shortcut walked its install folder on every scan instead
of reusing the ranking the scan keeps.

* Search a library for install scripts after the session has started, not before

* fix(session): keep deferred seeding off a running prefix and recheck old folder caches

* test(session): bound the held library search in the deferred seeding test

* fix(session): search a game again when its install script search failed
This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-11-12 16:03:41 -05:00
1 parent 39a4a1b60c
commit b5f6122d49
6 files changed
+204 -15

No files matched your search

@@ -374,6 +374,20 @@ class BattleNetTest {
}
@Test fun aScannedGamesShortcutReusesTheKeptRankingInsteadOfWalkingItsFolder() {
val added = com.droiddeck.launcher.frontend.AddedGames
val folder = File(BattleNet.prefix(context), "pfx/drive_c/Program Files (x86)/Kept Game").apply { mkdirs() }
File(folder, "Game.exe").writeBytes(byteArrayOf(0x4d, 0x5a))
val kept = File(folder, "Other.exe").apply { writeBytes(byteArrayOf(0x4d, 0x5a)) }
com.droiddeck.launcher.frontend.AddedGamesCache(File(context.filesDir, com.droiddeck.launcher.frontend.AddedGamesCache.FILE)).apply {
keepRank(folder, com.droiddeck.launcher.frontend.GameExePicker.Ranking(listOf(kept), listOf(10), false))
save()
}
added.scan(context)
assertEquals(kept, BattleNet.shortcut(context, BattleNet.Game("fenris", "Kept Game", "Fen", folder))!!.exe)
assertEquals("Game.exe", added.candidates(folder).first().name)
}
@Test fun aGamesShortcutHasBattleNetLaunchItInItsPrefix() {
val folder = File(BattleNet.prefix(context), "pfx/drive_c/Program Files (x86)/Diablo IV").apply { mkdirs() }
File(folder, "Diablo IV Launcher.exe").writeBytes(byteArrayOf(0x4d, 0x5a))