зеркало из https://github.com/mozilla/pjs.git
Bug 633406 - Check for problems getting the cache directory on Android r=blassey, a=fennec-crash
This commit is contained in:
Родитель
604c632167
Коммит
a5123ab95a
|
@ -110,10 +110,19 @@ class GeckoAppShell
|
|||
}
|
||||
|
||||
public static long getFreeSpace() {
|
||||
if (sFreeSpace == -1) {
|
||||
StatFs cacheStats = new StatFs(getCacheDir().getPath());
|
||||
sFreeSpace = cacheStats.getFreeBlocks() *
|
||||
cacheStats.getBlockSize();
|
||||
try {
|
||||
if (sFreeSpace == -1) {
|
||||
File cacheDir = getCacheDir();
|
||||
if (cacheDir != null) {
|
||||
StatFs cacheStats = new StatFs(cacheDir.getPath());
|
||||
sFreeSpace = cacheStats.getFreeBlocks() *
|
||||
cacheStats.getBlockSize();
|
||||
} else {
|
||||
Log.i("GeckoAppShell", "Unable to get cache dir");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("GeckoAppShell", "exception while stating cache dir: ", e);
|
||||
}
|
||||
return sFreeSpace;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче