[Android] MLStorage: fix double sd appearing
Duncan McNamara
git at videolan.org
Fri Jul 5 07:18:48 UTC 2024
vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Fri Jun 28 16:59:22 2024 +0200| [08e8d839afc04fdd3d998334373e07389857b3ea] | committer: Nicolas Pomepuy
MLStorage: fix double sd appearing
Checking to see if the directory is readable removes the wrong
sd card
> https://code.videolan.org/videolan/vlc-android/commit/08e8d839afc04fdd3d998334373e07389857b3ea
---
.../vlc-android/src/org/videolan/vlc/providers/StorageProvider.kt | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/providers/StorageProvider.kt b/application/vlc-android/src/org/videolan/vlc/providers/StorageProvider.kt
index c3e5060473..ed17fc9c40 100644
--- a/application/vlc-android/src/org/videolan/vlc/providers/StorageProvider.kt
+++ b/application/vlc-android/src/org/videolan/vlc/providers/StorageProvider.kt
@@ -45,7 +45,8 @@ class StorageProvider(context: Context, dataset: LiveDataset<MediaLibraryItem>,
var storage: Storage
val storagesList = ArrayList<MediaLibraryItem>()
for (mediaDirLocation in storages) {
- if (!File(mediaDirLocation).exists()) continue
+ val file = File(mediaDirLocation)
+ if (!file.exists() || !file.canRead()) continue
if (mediaDirLocation.isEmpty()) continue
storage = Storage(Uri.fromFile(File(mediaDirLocation)))
if (AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY == mediaDirLocation)
More information about the Android
mailing list