Ensure exists directory

This commit is contained in:
M66B
2022-10-06 14:43:44 +02:00
parent bdfb324441
commit ff0f2e9ec0
12 changed files with 39 additions and 62 deletions

View File

@@ -340,9 +340,7 @@ public class ContactInfo {
final String domain = d.toLowerCase(Locale.ROOT);
final String email = info.email.toLowerCase(Locale.ROOT);
File dir = new File(context.getFilesDir(), "favicons");
if (!dir.exists())
dir.mkdir();
File dir = Helper.ensureExists(new File(context.getFilesDir(), "favicons"));
try {
// check cache
@@ -511,10 +509,7 @@ public class ContactInfo {
// Generated
boolean identicon = false;
if (info.bitmap == null && generated && !TextUtils.isEmpty(info.email)) {
File dir = new File(context.getFilesDir(), "generated");
if (!dir.exists())
dir.mkdir();
File dir = Helper.ensureExists(new File(context.getFilesDir(), "generated"));
File[] files = dir.listFiles(new FilenameFilter() {
@Override
public boolean accept(File file, String name) {