aboutsummaryrefslogtreecommitdiff
path: root/src/github/daneren2005
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-12-22 20:56:30 -0800
committerScott Jackson <daneren2005@gmail.com>2013-12-22 20:56:30 -0800
commitcfa235f310777f58aefe95f4a4d4badf7d032e0f (patch)
tree14890bf8eaa4aaf1ee3c584e5849ee0c83f366f2 /src/github/daneren2005
parent24b292bc472ba66fa12ddf49ab2ceb0513b3063d (diff)
downloaddsub-cfa235f310777f58aefe95f4a4d4badf7d032e0f.tar.gz
dsub-cfa235f310777f58aefe95f4a4d4badf7d032e0f.tar.bz2
dsub-cfa235f310777f58aefe95f4a4d4badf7d032e0f.zip
#226 Delete all .ser files when clearing cache
Diffstat (limited to 'src/github/daneren2005')
-rw-r--r--src/github/daneren2005/dsub/activity/SettingsActivity.java1
-rw-r--r--src/github/daneren2005/dsub/util/FileUtil.java8
2 files changed, 9 insertions, 0 deletions
diff --git a/src/github/daneren2005/dsub/activity/SettingsActivity.java b/src/github/daneren2005/dsub/activity/SettingsActivity.java
index f8fed602..1807237c 100644
--- a/src/github/daneren2005/dsub/activity/SettingsActivity.java
+++ b/src/github/daneren2005/dsub/activity/SettingsActivity.java
@@ -125,6 +125,7 @@ public class SettingsActivity extends PreferenceActivity implements SharedPrefer
@Override
protected Void doInBackground() throws Throwable {
FileUtil.deleteMusicDirectory(SettingsActivity.this);
+ FileUtil.deleteSerializedCache(SettingsActivity.this);
return null;
}
diff --git a/src/github/daneren2005/dsub/util/FileUtil.java b/src/github/daneren2005/dsub/util/FileUtil.java
index 2c717416..852fc2ab 100644
--- a/src/github/daneren2005/dsub/util/FileUtil.java
+++ b/src/github/daneren2005/dsub/util/FileUtil.java
@@ -22,6 +22,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
+import java.io.FilenameFilter;
import java.io.RandomAccessFile;
import java.io.Serializable;
import java.util.Arrays;
@@ -228,6 +229,13 @@ public class FileUtil {
File musicDirectory = FileUtil.getMusicDirectory(context);
return Util.recursiveDelete(musicDirectory);
}
+ public static void deleteSerializedCache(Context context) {
+ for(File file: context.getCacheDir().listFiles()) {
+ if(file.getName().indexOf(".ser") != -1) {
+ file.delete();
+ }
+ }
+ }
public static boolean ensureDirectoryExistsAndIsReadWritable(File dir) {
if (dir == null) {