Better attempt at fixing boot crash when SD card is not ready?
This commit is contained in:
parent
1764ceb55a
commit
63e37a879f
@ -485,6 +485,8 @@ public class DB {
|
||||
|
||||
}
|
||||
|
||||
// Get the local storage (cache) path. This will also create it if
|
||||
// it doesn't exist. It can return null if it's currently unavailable.
|
||||
public static File getDataPath(Context ctx) {
|
||||
File f;
|
||||
if (Utils.hasApi(8)) {
|
||||
@ -492,12 +494,22 @@ public class DB {
|
||||
} else {
|
||||
f = new File(Environment.getExternalStorageDirectory(),
|
||||
"Android/data/org.fdroid.fdroid/cache");
|
||||
if(f != null) {
|
||||
if(!f.exists())
|
||||
f.mkdirs();
|
||||
}
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
public static File getIconsPath(Context ctx) {
|
||||
return new File(getDataPath(ctx), "icons");
|
||||
File dp = getDataPath(ctx);
|
||||
if(dp == null)
|
||||
return null;
|
||||
File ip = new File(dp, "icons");
|
||||
if(!ip.exists())
|
||||
ip.mkdirs();
|
||||
return ip;
|
||||
}
|
||||
|
||||
private Context mContext;
|
||||
|
@ -37,9 +37,7 @@ public class FDroidApp extends Application {
|
||||
super.onCreate();
|
||||
|
||||
File local_path = DB.getDataPath(this);
|
||||
Log.d("FDroid", "Data path is " + local_path.getPath());
|
||||
if (!local_path.exists())
|
||||
local_path.mkdir();
|
||||
|
||||
// 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),
|
||||
@ -59,11 +57,6 @@ public class FDroidApp extends Application {
|
||||
}
|
||||
}
|
||||
|
||||
File icon_path = DB.getIconsPath(this);
|
||||
Log.d("FDroid", "Icon path is " + icon_path.getPath());
|
||||
if (!icon_path.exists())
|
||||
icon_path.mkdir();
|
||||
|
||||
apps = null;
|
||||
invalidApps = new ArrayList<String>();
|
||||
Context ctx = getApplicationContext();
|
||||
|
Loading…
x
Reference in New Issue
Block a user