fix(library): persist explicitly selected executables in discovered folders (#2818)

fix(library): keep re-selected executables and store launchers across scans
This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-11-24 17:50:14 -05:00
1 parent 46d42f9ca9
commit 58430cd393
3 files changed
+59 -3

No files matched your search

@@ -337,7 +337,10 @@ object AddedGames {
val owner = ownerFolder(app, exe)
if (owner != null && owner.path !in SessionPrefs.removedAddedGames(app)) {
single(app, owner.path)?.takeIf { canonical(it.exe) == path }?.let {
if (guestPath(app, exe) != null) AddedExes.put(app, AddedExes.Entry(owner.path, exe.path))
if (guestPath(app, it.exe) != null) {
SessionPrefs.setAddedGameExe(app, owner.path, it.exe.path)
AddedExes.put(app, AddedExes.Entry(owner.path, it.exe.path))
}
return AddResult.Existing(it)
}
}
@@ -443,9 +446,9 @@ object AddedGames {
val chosen = picked.takeIf { it.isNotEmpty() }?.let { File(it) }?.takeIf { it.isFile }
?: single?.takeIf { it.picked }?.let { File(it.exe) }?.takeIf { it.isFile }
val found = chosen ?: sidecar?.exeFile(folder)?.takeIf { it.isFile } ?: candidates.firstOrNull() ?: return
val epicLauncher = sidecar?.takeIf { it.store == Store.EPIC && (chosen == null || canonical(chosen) == canonical(it.exeFile(folder))) }
val storeLauncher = sidecar?.takeIf { chosen == null || canonical(chosen) == canonical(it.exeFile(folder)) }
?.launcherFile(folder)?.takeIf { it.isFile }
val launch = epicLauncher ?: if (chosen == null) sidecar?.launcherFile(folder)?.takeIf { it.isFile } ?: found else found
val launch = storeLauncher ?: found
val foundGuest = guestPath(context, launch)
if (foundGuest == null) { Log.w(TAG, "${folder.name}: the session cannot see ${launch.path}"); return }
val autoName = sidecar?.title ?: identifiedName(folder, found) ?: folder.name