From df9c84b90a49d6fe0b18429d83fee5b7ca24c030 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Tue, 1 Apr 2014 18:33:25 -0700 Subject: Try to make sure using the SDCard for default music location --- src/github/daneren2005/dsub/util/FileUtil.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/github/daneren2005/dsub/util/FileUtil.java b/src/github/daneren2005/dsub/util/FileUtil.java index 4b425775..dc3a1a71 100644 --- a/src/github/daneren2005/dsub/util/FileUtil.java +++ b/src/github/daneren2005/dsub/util/FileUtil.java @@ -44,6 +44,7 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Build; import android.os.Environment; +import android.support.v4.content.ContextCompat; import android.util.Log; import github.daneren2005.dsub.domain.Artist; import github.daneren2005.dsub.domain.Genre; @@ -313,7 +314,11 @@ public class FileUtil { public static File getDefaultMusicDirectory(Context context) { if(DEFAULT_MUSIC_DIR == null) { - DEFAULT_MUSIC_DIR = createDirectory(context, "music"); + File[] dirs = ContextCompat.getExternalFilesDirs(context, null); + DEFAULT_MUSIC_DIR = new File(dirs[dirs.length - 1], "music"); + if (!DEFAULT_MUSIC_DIR.exists() && !DEFAULT_MUSIC_DIR.mkdirs()) { + Log.e(TAG, "Failed to create " + "music"); + } } return DEFAULT_MUSIC_DIR; -- cgit v1.2.3