jimu-decompiled/sources/com/baidu/cloud/videocache/ab.java
2025-05-13 19:24:51 +02:00

45 lines
1.4 KiB
Java

package com.baidu.cloud.videocache;
import android.content.Context;
import android.os.Environment;
import java.io.File;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/* loaded from: classes.dex */
final class ab {
private static final Logger a = LoggerFactory.getLogger("StorageUtils");
public static File a(Context context) {
return new File(a(context, true), "video-cache");
}
private static File a(Context context, boolean z) {
String str;
try {
str = Environment.getExternalStorageState();
} catch (NullPointerException unused) {
str = "";
}
File b = (z && "mounted".equals(str)) ? b(context) : null;
if (b == null) {
b = context.getCacheDir();
}
if (b != null) {
return b;
}
String str2 = "/data/data/" + context.getPackageName() + "/cache/";
a.warn("Can't define system cache directory! '" + str2 + "%s' will be used.");
return new File(str2);
}
private static File b(Context context) {
File file = new File(new File(new File(new File(Environment.getExternalStorageDirectory(), "Android"), "data"), context.getPackageName()), "cache");
if (file.exists() || file.mkdirs()) {
return file;
}
a.warn("Unable to create external cache directory");
return null;
}
}