[Android] scan: remove old folders which doesn't exists anymore

Sébastien Toque git at videolan.org
Mon Aug 20 23:26:05 CEST 2012


vlc-ports/android | branch: master | Sébastien Toque <xilasz at gmail.com> | Mon Aug 20 23:25:57 2012 +0200| [a660f6d9da4efedac370c7ab52bc4a76d24eeab3] | committer: Sébastien Toque

scan: remove old folders which doesn't exists anymore

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

 vlc-android/src/org/videolan/vlc/MediaLibrary.java |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/MediaLibrary.java b/vlc-android/src/org/videolan/vlc/MediaLibrary.java
index 6824f62..f83784f 100644
--- a/vlc-android/src/org/videolan/vlc/MediaLibrary.java
+++ b/vlc-android/src/org/videolan/vlc/MediaLibrary.java
@@ -244,12 +244,16 @@ public class MediaLibrary {
                 h.sendEmptyMessage(MEDIA_ITEMS_UPDATED);
             }
 
-            // remove file from database if storage is mounted
+            // remove old files & folders from database if storage is mounted
             if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
                 for (String fileURI : addedLocations) {
                     existingMedias.remove(fileURI);
                 }
                 mDBManager.removeMedias(existingMedias.keySet());
+
+                for (File file : mDBManager.getMediaDirs())
+                    if (!file.isDirectory())
+                        mDBManager.removeDir(file.getAbsolutePath());
             }
 
             // hide progressbar in footer



More information about the Android mailing list