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

@@ -132,10 +132,7 @@ public class AdapterCertificate extends RecyclerView.Adapter<AdapterCertificate.
if (certificate == null)
return null;
File dir = new File(context.getFilesDir(), "shared");
if (!dir.exists())
dir.mkdir();
File dir = Helper.ensureExists(new File(context.getFilesDir(), "shared"));
String name = Helper.sanitizeFilename(certificate.email);
File file = new File(dir, name + ".pem");
Helper.writeText(file, certificate.getPem());