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) {
|
public static File getDataPath(Context ctx) {
|
||||||
File f;
|
File f;
|
||||||
if (Utils.hasApi(8)) {
|
if (Utils.hasApi(8)) {
|
||||||
@ -492,12 +494,22 @@ public class DB {
|
|||||||
} else {
|
} else {
|
||||||
f = new File(Environment.getExternalStorageDirectory(),
|
f = new File(Environment.getExternalStorageDirectory(),
|
||||||
"Android/data/org.fdroid.fdroid/cache");
|
"Android/data/org.fdroid.fdroid/cache");
|
||||||
|
if(f != null) {
|
||||||
|
if(!f.exists())
|
||||||
|
f.mkdirs();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static File getIconsPath(Context ctx) {
|
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;
|
private Context mContext;
|
||||||
|
@ -37,9 +37,7 @@ public class FDroidApp extends Application {
|
|||||||
super.onCreate();
|
super.onCreate();
|
||||||
|
|
||||||
File local_path = DB.getDataPath(this);
|
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
|
// Clear cached apk files. We used to just remove them after they'd
|
||||||
// been installed, but this causes problems for proprietary gapps
|
// been installed, but this causes problems for proprietary gapps
|
||||||
// users since the introduction of verification (on pre-4.2 Android),
|
// 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;
|
apps = null;
|
||||||
invalidApps = new ArrayList<String>();
|
invalidApps = new ArrayList<String>();
|
||||||
Context ctx = getApplicationContext();
|
Context ctx = getApplicationContext();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user