Avoiding conflicted for creating directory.

This commit is contained in:
wangchenjun 2019-09-17 16:34:06 +08:00
parent e24a75c2bc
commit 4ed7aa350b

View File

@ -150,9 +150,13 @@ public class DiskCache {
private static File makeSureCacheDirExists(String dir) {
File cacheDir = new File(dir);
if (!cacheDir.exists() && !cacheDir.mkdirs()) {
if (!cacheDir.exists()) {
if (!cacheDir.mkdirs() && !cacheDir.exists()) {
throw new IllegalStateException("failed to create cache dir: " + dir);
}
}
return cacheDir;
}