Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/org/adblockplus/sbrowser/contentblocker/engine/Engine.java

Issue 29355392: Issue 4485 - Clear cache directory (Closed)
Patch Set: Created Sept. 30, 2016, 2:48 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/org/adblockplus/sbrowser/contentblocker/engine/Subscriptions.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « no previous file | src/org/adblockplus/sbrowser/contentblocker/engine/Subscriptions.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld