diff options
Diffstat (limited to 'src/github')
-rw-r--r-- | src/github/daneren2005/dsub/util/FileUtil.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/github/daneren2005/dsub/util/FileUtil.java b/src/github/daneren2005/dsub/util/FileUtil.java index 7afeec93..ac2c080b 100644 --- a/src/github/daneren2005/dsub/util/FileUtil.java +++ b/src/github/daneren2005/dsub/util/FileUtil.java @@ -403,7 +403,13 @@ public class FileUtil { public static File getDefaultMusicDirectory(Context context) { if(DEFAULT_MUSIC_DIR == null) { - File[] dirs = ContextCompat.getExternalFilesDirs(context, null); + File[] dirs; + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + dirs = context.getExternalMediaDirs(); + } else { + dirs = ContextCompat.getExternalFilesDirs(context, null); + } + for(int i = dirs.length - 1; i >= 0; i--) { DEFAULT_MUSIC_DIR = new File(dirs[i], "music"); if(dirs[i] != null) { |