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

@@ -150,9 +150,7 @@ public class EntityAttachment {
}
static File getFile(Context context, long id, String name) {
File dir = new File(getRoot(context), "attachments");
if (!dir.exists())
dir.mkdir();
File dir = Helper.ensureExists(new File(getRoot(context), "attachments"));
String filename = Long.toString(id);
if (!TextUtils.isEmpty(name))
filename += "." + Helper.sanitizeFilename(name);