Fix one more spot that assumed external storage was available.

This commit is contained in:
James Sanford 2013-02-20 15:45:54 -08:00
parent 4abd03387d
commit 1c73953ad3

View File

@ -44,7 +44,12 @@ class ConfigFile {
} }
public String getCachePath() { public String getCachePath() {
return mContext.getExternalCacheDir().getPath(); File cacheDir = mContext.getExternalCacheDir();
if (cacheDir == null) {
// Use internal storage if external directory is not available.
cacheDir = mContext.getCacheDir();
}
return cacheDir.getPath();
} }
public String[] getAllImageDirs() { public String[] getAllImageDirs() {
@ -53,11 +58,11 @@ class ConfigFile {
String externalStorage; String externalStorage;
File externalDir = Environment.getExternalStorageDirectory(); File externalDir = Environment.getExternalStorageDirectory();
if (externalDir != null) { if (externalDir == null) {
externalStorage = externalDir.getPath();
} else {
// Try harder. It is OK if this does not exist. // Try harder. It is OK if this does not exist.
externalStorage = "/mnt/sdcard"; externalStorage = "/mnt/sdcard";
} else {
externalStorage = externalDir.getPath();
} }
String[] dirs = { String[] dirs = {