Double-check that the cache directory does not exist and is a directory

This commit is contained in:
Artem Chepurnoy 2021-01-15 18:30:36 +02:00
parent dde0b9b614
commit c1501a3c6a

View File

@ -837,7 +837,7 @@ public final class SimpleCache implements Cache {
}
private static void createCacheDirectories(File cacheDir) throws CacheException {
if (!cacheDir.mkdirs()) {
if (!cacheDir.mkdirs() && !cacheDir.isDirectory()) {
String message = "Failed to create cache directory: " + cacheDir;
Log.e(TAG, message);
throw new CacheException(message);