aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-04-01 18:33:25 -0700
committerScott Jackson <daneren2005@gmail.com>2014-04-01 18:33:25 -0700
commitdf9c84b90a49d6fe0b18429d83fee5b7ca24c030 (patch)
treeceea9d83db0e7d5bda92787f910d4866a01720b1
parent6f76741252d5eb06705b0b1b3d70ebafce704036 (diff)
downloaddsub-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.java7
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;