Index: src/org/adblockplus/sbrowser/contentblocker/engine/Engine.java |
=================================================================== |
--- a/src/org/adblockplus/sbrowser/contentblocker/engine/Engine.java |
+++ b/src/org/adblockplus/sbrowser/contentblocker/engine/Engine.java |
@@ -251,16 +251,26 @@ public final class Engine |
{ |
Log.d(TAG, "Writing filters..."); |
final File filterFile = this.subscriptions.createAndWriteFile(); |
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this.serviceContext); |
final String key = this.serviceContext.getString(R.string.key_cached_filter_path); |
prefs.edit().putString(key, filterFile.getAbsolutePath()).commit(); |
+ Log.d(TAG, "Cleaning up cache..."); |
+ final File dummyFile = getDummyFilterFile(this.serviceContext); |
+ for (final File file : getFilterCacheDir(this.serviceContext).listFiles()) |
anton
2016/09/30 06:17:15
listFiles() can return `null` is getFilterCacheDir
diegocarloslima
2016/09/30 14:35:47
The directory should exists in order for the previ
|
+ { |
+ if (!file.equals(dummyFile) && !file.equals(filterFile)) |
+ { |
+ Log.d(TAG, "Deleting file:" + file); |
+ file.delete(); |
+ } |
+ } |
} |
catch (IOException e) |
{ |
Log.e(TAG, "Failed to write filters", e); |
} |
finally |
{ |
this.unlock(); |