diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-04-01 18:33:25 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-04-01 18:33:25 -0700 |
commit | df9c84b90a49d6fe0b18429d83fee5b7ca24c030 (patch) | |
tree | ceea9d83db0e7d5bda92787f910d4866a01720b1 | |
parent | 6f76741252d5eb06705b0b1b3d70ebafce704036 (diff) | |
download | dsub-df9c84b90a49d6fe0b18429d83fee5b7ca24c030.tar.gz dsub-df9c84b90a49d6fe0b18429d83fee5b7ca24c030.tar.bz2 dsub-df9c84b90a49d6fe0b18429d83fee5b7ca24c030.zip |
Try to make sure using the SDCard for default music location
-rw-r--r-- | src/github/daneren2005/dsub/util/FileUtil.java | 7 |
1 files changed, 6 insertions, 1 deletions
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; |