From 4de47bd810b56f9cc081d19db713ccb8b0906ab9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Tue, 23 Jul 2013 13:40:50 +0200 Subject: [PATCH] Only fetch local_path if necessary --- src/org/fdroid/fdroid/FDroidApp.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/org/fdroid/fdroid/FDroidApp.java b/src/org/fdroid/fdroid/FDroidApp.java index 438061040..6f2de086d 100644 --- a/src/org/fdroid/fdroid/FDroidApp.java +++ b/src/org/fdroid/fdroid/FDroidApp.java @@ -36,15 +36,16 @@ public class FDroidApp extends Application { public void onCreate() { super.onCreate(); - File local_path = DB.getDataPath(this); - // Clear cached apk files. We used to just remove them after they'd // been installed, but this causes problems for proprietary gapps // users since the introduction of verification (on pre-4.2 Android), // because the install intent says it's finished when it hasn't. SharedPreferences prefs = PreferenceManager .getDefaultSharedPreferences(getBaseContext()); - if(!prefs.getBoolean("cacheDownloaded", false)) { + if (!prefs.getBoolean("cacheDownloaded", false)) { + + File local_path = DB.getDataPath(this); + File[] files = local_path.listFiles(); // files can be null if the SD card is not ready - we'll just // ignore that and do it next time.