Don't get upset if the SD card is not ready yet

This commit is contained in:
Ciaran Gultnieks 2013-06-07 11:59:05 +01:00
parent 020cac971f
commit 9ec94e8e88

View File

@ -47,12 +47,17 @@ public class FDroidApp extends Application {
SharedPreferences prefs = PreferenceManager SharedPreferences prefs = PreferenceManager
.getDefaultSharedPreferences(getBaseContext()); .getDefaultSharedPreferences(getBaseContext());
if(!prefs.getBoolean("cacheDownloaded", false)) { if(!prefs.getBoolean("cacheDownloaded", false)) {
for(File f : local_path.listFiles()) { 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.
if(files != null) {
for(File f : files) {
if(f.getName().endsWith(".apk")) { if(f.getName().endsWith(".apk")) {
f.delete(); f.delete();
} }
} }
} }
}
File icon_path = DB.getIconsPath(); File icon_path = DB.getIconsPath();
Log.d("FDroid", "Icon path is " + icon_path.getPath()); Log.d("FDroid", "Icon path is " + icon_path.getPath());