diff options
Diffstat (limited to 'src/github/daneren2005')
-rw-r--r-- | src/github/daneren2005/dsub/util/FileUtil.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/github/daneren2005/dsub/util/FileUtil.java b/src/github/daneren2005/dsub/util/FileUtil.java index dc3a1a71..e9c5444b 100644 --- a/src/github/daneren2005/dsub/util/FileUtil.java +++ b/src/github/daneren2005/dsub/util/FileUtil.java @@ -315,9 +315,13 @@ public class FileUtil { public static File getDefaultMusicDirectory(Context context) { if(DEFAULT_MUSIC_DIR == null) { File[] dirs = ContextCompat.getExternalFilesDirs(context, null); - DEFAULT_MUSIC_DIR = new File(dirs[dirs.length - 1], "music"); + if(Util.isExternalStoragePresent()) { + DEFAULT_MUSIC_DIR = new File(dirs[dirs.length - 1], "music"); + } else { + DEFAULT_MUSIC_DIR = new File(context.getExternalFilesDir(null), "music"); + } if (!DEFAULT_MUSIC_DIR.exists() && !DEFAULT_MUSIC_DIR.mkdirs()) { - Log.e(TAG, "Failed to create " + "music"); + Log.e(TAG, "Failed to create default dir " + DEFAULT_MUSIC_DIR); } } |