fix(storage): a Second library folder that is there is used even when its volume state isn't mounted (#2258)

fix(storage): a saved game folder that is there stays the library
This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-11-08 00:32:04 -05:00
1 parent e4a4775be5
commit 15baa296bb
2 files changed
+10 -1

No files matched your search

@@ -68,8 +68,9 @@ object GameStorage {
externalStoragePath: Boolean = isExternalStoragePath(path),
): Boolean = when {
state == Environment.MEDIA_MOUNTED || state == Environment.MEDIA_MOUNTED_READ_ONLY -> true
path.isDirectory -> true
externalStoragePath -> false
state == Environment.MEDIA_UNKNOWN || state == null -> path.isDirectory || path.parentFile?.isDirectory == true
state == Environment.MEDIA_UNKNOWN || state == null -> path.parentFile?.isDirectory == true
else -> false
}
@@ -95,6 +95,14 @@ class GameStorageTest {
assertFalse(GameStorage.attached(File("/mnt/media_rw/B2BD-BCFC/STEAM GAMES")) { null })
}
@Test fun aSavedFolderThatIsThereIsAttachedWhateverItsVolumeReports() {
val folder = tmp.newFolder("card", "STEAM GAMES")
listOf(Environment.MEDIA_UNKNOWN, Environment.MEDIA_UNMOUNTED, Environment.MEDIA_REMOVED, null).forEach {
assertTrue(GameStorage.attached(folder, it, externalStoragePath = true))
}
assertTrue(GameStorage.attached(folder) { Environment.MEDIA_UNKNOWN })
}
@Test fun onlyASavedDriveThatIsMissingCountsAsDisconnected() {
SessionPrefs.setGameStorage(app, "", "")
assertFalse(GameStorage.disconnected(app))