mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-02 11:05:39 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14cabd6bb9 |
No files matched your search
@@ -243,7 +243,7 @@ object Library {
|
||||
if (runCatching { SteamGrid.sync(context, targets) }.getOrDefault(false)) steam = steamGames(context, strictRead, arch)
|
||||
val claimed = claimedFolders(steam)
|
||||
val own = list.filter { g ->
|
||||
g.steamAppId != null || claimed.isEmpty() ||
|
||||
g.steamAppId != null || !g.steamProgram || claimed.isEmpty() ||
|
||||
(runCatching { g.folder.canonicalPath }.getOrDefault(g.folder.absolutePath) !in claimed &&
|
||||
AddedGames.guestPath(context, g.folder).let { it == null || it !in claimed })
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.droiddeck.launcher.frontend
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import java.io.File
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
@@ -49,4 +50,20 @@ class LibraryArchTest {
|
||||
val second = AddedGames.Game(other, "Other", File(other, "Other.exe"), "/g/Other.exe", "/g", 0x81234567L, (0x81234567L shl 32) or 0x02000000L, emptyList())
|
||||
assertEquals(listOf("Example" to "internal", "Other" to Library.ADDED), Library.launchableGames(app, added = listOf(added, second), arch = "arm64").map { it.name to it.library })
|
||||
}
|
||||
|
||||
@Test fun anotherProgramPickedInASteamGamesFolderIsListedBesideTheSteamGame() {
|
||||
SessionPrefs.setGameStorage(app, SessionPrefs.GAME_STORAGE_OFF, "")
|
||||
SessionPrefs.setAddedGamesDirs(app, emptyList())
|
||||
SessionPrefs.setSteamClientArch(app, "arm64")
|
||||
val apps = File(SessionPrefs.steamRoot(app, "arm64"), "steamapps").apply { mkdirs() }
|
||||
val folder = File(apps, "common/Example").apply { mkdirs() }
|
||||
val main = File(folder, "Example.exe").apply { writeBytes(ByteArray(16)) }
|
||||
val launcher = File(folder, "ModLauncher.exe").apply { writeBytes(ByteArray(16)) }
|
||||
File(apps, "appmanifest_42.acf").writeText("\"AppState\"\n{\n\t\"appid\"\t\t\"42\"\n\t\"name\"\t\t\"Example\"\n\t\"StateFlags\"\t\t\"4\"\n\t\"installdir\"\t\t\"Example\"\n}\n")
|
||||
fun listed() = Library.launchableGames(app, arch = "arm64").map { it.library to it.gameFiles }
|
||||
assertTrue(AddedGames.addExe(app, launcher) is AddedGames.AddResult.Added)
|
||||
assertEquals(listOf("internal" to folder, Library.ADDED to folder), listed())
|
||||
assertTrue(AddedGames.addExe(app, main) is AddedGames.AddResult.Switched)
|
||||
assertEquals(listOf("internal" to folder), listed())
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user