aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
index 7444229b..7e047a94 100644
--- a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
+++ b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
@@ -434,9 +434,14 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
PreferenceManager.setDefaultValues(this, R.xml.settings, false);
SharedPreferences prefs = Util.getPreferences(this);
if (!prefs.contains(Constants.PREFERENCES_KEY_CACHE_LOCATION)) {
- SharedPreferences.Editor editor = prefs.edit();
- editor.putString(Constants.PREFERENCES_KEY_CACHE_LOCATION, FileUtil.getDefaultMusicDirectory(this).getPath());
- editor.commit();
+ resetCacheLocation(prefs);
+ } else {
+ String path = prefs.getString(Constants.PREFERENCES_KEY_CACHE_LOCATION, null);
+ File cacheLocation = new File(path);
+ if(!FileUtil.ensureDirectoryExistsAndIsReadWritable(cacheLocation)) {
+ resetCacheLocation(prefs);
+ Util.info(this, R.string.common_warning, R.string.settings_cache_location_reset);
+ }
}
if (!prefs.contains(Constants.PREFERENCES_KEY_OFFLINE)) {
@@ -457,6 +462,12 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
}
}
+ private void resetCacheLocation(SharedPreferences prefs) {
+ SharedPreferences.Editor editor = prefs.edit();
+ editor.putString(Constants.PREFERENCES_KEY_CACHE_LOCATION, FileUtil.getDefaultMusicDirectory(this).getPath());
+ editor.commit();
+ }
+
private void createAccount() {
final Context context = this;