mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-22 14:26:00 +00:00
fix: keep games being updated in the installed list for every store (#1989)
This commit is contained in:
1 parent
40dfcd94f9
commit
57b7c99b9a
3 files changed
+11
-2
No files matched your search
@@ -246,7 +246,7 @@ object StoreInstallRoot {
|
|||||||
val sidecar = StoreGameSidecar.read(folder)
|
val sidecar = StoreGameSidecar.read(folder)
|
||||||
when {
|
when {
|
||||||
sidecar == null -> Unfinished(store, null, folder)
|
sidecar == null -> Unfinished(store, null, folder)
|
||||||
store == Store.GOG && sidecar.state == StoreGameSidecar.STATE_UPDATING -> null
|
sidecar.state == StoreGameSidecar.STATE_UPDATING -> null
|
||||||
!sidecar.isInstalled -> Unfinished(store, sidecar.id, folder)
|
!sidecar.isInstalled -> Unfinished(store, sidecar.id, folder)
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ object StoresState {
|
|||||||
runCatching { com.droiddeck.launcher.stores.battlenet.BattleNetClient.syncAccount(app) }
|
runCatching { com.droiddeck.launcher.stores.battlenet.BattleNetClient.syncAccount(app) }
|
||||||
val found = Store.entries.mapNotNull { store -> StoreAccounts.displayName(app, store)?.let { store to it } }
|
val found = Store.entries.mapNotNull { store -> StoreAccounts.displayName(app, store)?.let { store to it } }
|
||||||
val onDisk = StoreInstallRoot.gameFolders(app).mapNotNull { folder ->
|
val onDisk = StoreInstallRoot.gameFolders(app).mapNotNull { folder ->
|
||||||
StoreGameSidecar.read(folder)?.takeIf { it.isInstalled || it.store == Store.GOG && it.state == StoreGameSidecar.STATE_UPDATING }?.let { InstalledStoreGame(it, folder) }
|
StoreGameSidecar.read(folder)?.takeIf { it.isInstalled || it.state == StoreGameSidecar.STATE_UPDATING }?.let { InstalledStoreGame(it, folder) }
|
||||||
} + runCatching { com.droiddeck.launcher.stores.battlenet.BattleNetBackend.installedGames(app) }.getOrDefault(emptyList())
|
} + runCatching { com.droiddeck.launcher.stores.battlenet.BattleNetBackend.installedGames(app) }.getOrDefault(emptyList())
|
||||||
val partial = StoreInstallRoot.unfinished(app)
|
val partial = StoreInstallRoot.unfinished(app)
|
||||||
val version = if (StoresNative.available) StoresNative.version ?: "" else ""
|
val version = if (StoresNative.available) StoresNative.version ?: "" else ""
|
||||||
|
|||||||
@@ -201,6 +201,15 @@ class StoreInstallRootTest {
|
|||||||
assertTrue(StoreInstallRoot.unfinished(app).none { it.folder.absolutePath == half.absolutePath })
|
assertTrue(StoreInstallRoot.unfinished(app).none { it.folder.absolutePath == half.absolutePath })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test fun aGameBeingUpdatedIsNotAnUnfinishedInstallForAnyStore() {
|
||||||
|
SessionPrefs.setGameStorage(app, SessionPrefs.GAME_STORAGE_OFF, "")
|
||||||
|
for (store in listOf(Store.EPIC, Store.ITCH, Store.XBOX, Store.AMAZON)) {
|
||||||
|
val folder = File(StoreInstallRoot.storeDir(StoreInstallRoot.internalRoot(app), store), StoreInstallRoot.folderName("Updating", "u1")).apply { mkdirs() }
|
||||||
|
StoreGameSidecar(store, "u1", "Updating", "Updating.exe", state = StoreGameSidecar.STATE_UPDATING).write(folder)
|
||||||
|
assertTrue(StoreInstallRoot.unfinished(app).none { it.folder.absolutePath == folder.absolutePath })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test fun theScratchCacheIsPrivateAndNamedSafely() {
|
@Test fun theScratchCacheIsPrivateAndNamedSafely() {
|
||||||
val dir = StoreInstallRoot.scratchDir(app, Store.EPIC, "a/b:c")
|
val dir = StoreInstallRoot.scratchDir(app, Store.EPIC, "a/b:c")
|
||||||
assertTrue(dir.absolutePath.startsWith(app.cacheDir.absolutePath))
|
assertTrue(dir.absolutePath.startsWith(app.cacheDir.absolutePath))
|
||||||
|
|||||||
Reference in new issue
Block a user