Commit 91613e91 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Remove subfolders while adding a directory

parent e651a06b
......@@ -33,7 +33,6 @@ import android.widget.CheckBox;
import org.videolan.libvlc.Media;
import org.videolan.vlc.MediaWrapper;
import org.videolan.vlc.R;
import org.videolan.vlc.util.Strings;
public class StorageBrowserAdapter extends BaseBrowserAdapter {
......@@ -138,10 +137,16 @@ public class StorageBrowserAdapter extends BaseBrowserAdapter {
@Override
public void run() {
mDbManager.addDir(path);
String parentPath = Strings.getParent(path);
while (parentPath != null && !TextUtils.equals(parentPath, "/")) {
mDbManager.removeDir(parentPath);
parentPath = Strings.getParent(parentPath);
//No need to check for parents for now
// String parentPath = Strings.getParent(path);
// while (parentPath != null && !TextUtils.equals(parentPath, "/")) {
// mDbManager.removeDir(parentPath);
// parentPath = Strings.getParent(parentPath);
// }
//Remove subfolders, it would be redundant
for (String customDirPath : mMediaDirsLocation) {
if (customDirPath.startsWith(path+"/"))
mDbManager.removeDir(customDirPath);
}
refreshFragment();
updateMediaDirs();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment