[Android] Do not hardcode /sdcard

Jean-Baptiste Kempf git at videolan.org
Thu Jun 21 18:29:06 CEST 2012


android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Thu Jun 21 18:27:27 2012 +0200| [fa9a6f8a716f6897483cb59aa1616f851673352b] | committer: Jean-Baptiste Kempf

Do not hardcode /sdcard

> http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=fa9a6f8a716f6897483cb59aa1616f851673352b
---

 vlc-android/src/org/videolan/vlc/Media.java |   23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/Media.java b/vlc-android/src/org/videolan/vlc/Media.java
index fb7caf1..628b05f 100644
--- a/vlc-android/src/org/videolan/vlc/Media.java
+++ b/vlc-android/src/org/videolan/vlc/Media.java
@@ -45,24 +45,25 @@ public class Media implements Comparable<Media> {
                 ".awb", ".cda", ".dts", ".flac", ".it", ".m4a", ".m4p", ".mid", ".mka", ".mlp", ".mod",
                 ".mp1", ".mp2", ".mp3", ".mpc", ".oga", ".ogg", ".oma", ".rmi", ".s3m", ".spx", ".tta",
                 ".voc", ".vqf", ".w64", ".wav", ".wma", ".wv", ".xa", ".xm" };
+
         String[] folder_blacklist = {
-                "/sdcard/alarms",
-                "/sdcard/notifications",
-                "/sdcard/ringtones",
-                "/sdcard/media/alarms",
-                "/sdcard/media/notifications",
-                "/sdcard/media/ringtones",
-                "/sdcard/media/audio/alarms",
-                "/sdcard/media/audio/notifications",
-                "/sdcard/media/audio/ringtones",
-                "/sdcard/Android/data/" };
+                "/alarms",
+                "/notifications",
+                "/ringtones",
+                "/media/alarms",
+                "/media/notifications",
+                "/media/ringtones",
+                "/media/audio/alarms",
+                "/media/audio/notifications",
+                "/media/audio/ringtones",
+                "/Android/data/" };
 
         EXTENTIONS = new HashSet<String>();
         for (String item : extensions)
             EXTENTIONS.add(item);
         FOLDER_BLACKLIST = new HashSet<String>();
         for (String item : folder_blacklist)
-            FOLDER_BLACKLIST.add(item);
+            FOLDER_BLACKLIST.add(android.os.Environment.getExternalStorageDirectory().getPath() + item);
     }
 
     public final static int TYPE_ALL = -1;



More information about the Android mailing list