aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-03-03 17:55:05 -0800
committerScott Jackson <daneren2005@gmail.com>2014-03-03 17:55:05 -0800
commitc9795f949df7ad3becc89f41b73a616d7c0ee483 (patch)
tree1ce22bae253a9dc51de6a8438a06f07beab1fa5d
parent4699dfddcbe616af65de672fcbbfc407cc65ceff (diff)
parentd1da3fcf362584224aba0dbf6ba77cc47f079b14 (diff)
downloaddsub-c9795f949df7ad3becc89f41b73a616d7c0ee483.tar.gz
dsub-c9795f949df7ad3becc89f41b73a616d7c0ee483.tar.bz2
dsub-c9795f949df7ad3becc89f41b73a616d7c0ee483.zip
Merge branch 'samsung' of https://github.com/daneren2005/Subsonic
-rw-r--r--AndroidManifest.xml4
-rw-r--r--res/raw/changelog.xml3
-rw-r--r--src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java2
-rw-r--r--src/github/daneren2005/dsub/util/FileUtil.java13
4 files changed, 19 insertions, 3 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 6858e64c..f2d4740d 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="github.daneren2005.dsub"
android:installLocation="internalOnly"
- android:versionCode="93"
- android:versionName="4.5.3">
+ android:versionCode="94"
+ android:versionName="4.5.4">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
diff --git a/res/raw/changelog.xml b/res/raw/changelog.xml
index 1bf5d58a..fb208892 100644
--- a/res/raw/changelog.xml
+++ b/res/raw/changelog.xml
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<changelog>
+ <release version="4.5.4" versioncode="94" releasedate="3/3/2014">
+ <change>Fix cache location reset for Samsung upgrades</change>
+ </release>
<release version="4.5.3" versioncode="93" releasedate="2/26/2014">
<change>WARNING: Please read the first change!</change>
<change>Google changed Android so that apps can only write to a specific location on a SD card for 4.4+. Samsung is currently upgrading their phones to 4.4, so if you have a Galaxy phone you will probably receive a notification that the cache location has been changed to the only place DSub can write to now. Everyone else's settings will be left alone, but the default cache location has also been changed.</change>
diff --git a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
index ce08d422..5aee380f 100644
--- a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
+++ b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
@@ -443,7 +443,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
} else {
String path = prefs.getString(Constants.PREFERENCES_KEY_CACHE_LOCATION, null);
File cacheLocation = new File(path);
- if(!FileUtil.ensureDirectoryExistsAndIsReadWritable(cacheLocation)) {
+ if(!FileUtil.verifyCanWrite(cacheLocation)) {
resetCacheLocation(prefs);
Util.info(this, R.string.common_warning, R.string.settings_cache_location_reset);
}
diff --git a/src/github/daneren2005/dsub/util/FileUtil.java b/src/github/daneren2005/dsub/util/FileUtil.java
index 95917429..a1983fde 100644
--- a/src/github/daneren2005/dsub/util/FileUtil.java
+++ b/src/github/daneren2005/dsub/util/FileUtil.java
@@ -368,6 +368,19 @@ public class FileUtil {
}
return true;
}
+ public static boolean verifyCanWrite(File dir) {
+ if(ensureDirectoryExistsAndIsReadWritable(dir)) {
+ try {
+ File tmp = File.createTempFile("tmp", "tmp", dir);
+ tmp.delete();
+ return true;
+ } catch(Exception e) {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
/**
* Makes a given filename safe by replacing special characters like slashes ("/" and "\")