From 43be8f3fd10346e88fc552a638562cfa6ef22321 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 11 May 2016 19:25:30 +0200 Subject: [PATCH] delete temp files created by DownloaderFactory#create(Context, String) --- .../main/java/org/fdroid/fdroid/CleanCacheService.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/fdroid/fdroid/CleanCacheService.java b/app/src/main/java/org/fdroid/fdroid/CleanCacheService.java index 463af770d..2feb9d73d 100644 --- a/app/src/main/java/org/fdroid/fdroid/CleanCacheService.java +++ b/app/src/main/java/org/fdroid/fdroid/CleanCacheService.java @@ -59,10 +59,13 @@ public class CleanCacheService extends IntentService { * Delete index files which were downloaded, but not removed (e.g. due to F-Droid being * force closed during processing of the file, before getting a chance to delete). This * may include both "index-*-downloaded" and "index-*-extracted.xml" files. - *

+ *

* Note that if the SD card is not ready, then the cache directory will probably not be * available. In this situation no files will be deleted (and thus they may still exist * after the SD card becomes available). + *

+ * This also deletes temp files that are created by + * {@link org.fdroid.fdroid.net.DownloaderFactory#create(Context, String)}, e.g. "dl-*" */ private void deleteStrayIndexFiles() { File cacheDir = getCacheDir(); @@ -79,6 +82,9 @@ public class CleanCacheService extends IntentService { if (f.getName().startsWith("index-")) { FileUtils.deleteQuietly(f); } + if (f.getName().startsWith("dl-")) { + FileUtils.deleteQuietly(f); + } } } }