aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEvan Charlton <evancharlton@gmail.com>2013-03-25 19:09:56 -0400
committerEvan Charlton <evancharlton@gmail.com>2013-03-25 19:09:56 -0400
commitfc88bb5421b4e2aa7ebc21f60af61f05272661f8 (patch)
tree033b8e7c02c32102fdc898ee3a93fc9e5ca1c0e4 /src
parentb761f3da4a2f10015542c82c666d1523a97d1900 (diff)
downloadvolley-fc88bb5421b4e2aa7ebc21f60af61f05272661f8.tar.gz
Ensure that the cache folder exists
Make sure that the cache folder exists when using DiskBasedCache. Change-Id: I60e2c2b0b88c9a3a178e72dda05ab5f7290e33f0
Diffstat (limited to 'src')
-rw-r--r--src/com/android/volley/toolbox/DiskBasedCache.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/com/android/volley/toolbox/DiskBasedCache.java b/src/com/android/volley/toolbox/DiskBasedCache.java
index d421480..c04ba87 100644
--- a/src/com/android/volley/toolbox/DiskBasedCache.java
+++ b/src/com/android/volley/toolbox/DiskBasedCache.java
@@ -72,6 +72,12 @@ public class DiskBasedCache implements Cache {
public DiskBasedCache(File rootDirectory, int maxCacheSizeInBytes) {
mRootDirectory = rootDirectory;
mMaxCacheSizeInBytes = maxCacheSizeInBytes;
+
+ if (!mRootDirectory.exists()) {
+ if (!mRootDirectory.mkdirs()) {
+ VolleyLog.e("Unable to create cache dir %s", mRootDirectory.getAbsolutePath());
+ }
+ }
}
/**