getExternalFilesDir compat

This commit is contained in:
M66B
2022-11-03 16:57:53 +01:00
parent 8b5fd03117
commit cc0b6b1560
4 changed files with 20 additions and 8 deletions

View File

@@ -2275,6 +2275,18 @@ public class Helper {
return dir;
}
static File getExternalFilesDir(Context context) {
return getExternalFilesDir(context, null);
}
static File getExternalFilesDir(Context context, String type) {
File[] dirs = ContextCompat.getExternalFilesDirs(context, type);
if (dirs == null || dirs.length == 0)
return context.getExternalFilesDir(type);
else
return dirs[0];
}
static String sanitizeFilename(String name) {
if (name == null)
return null;