From 66abdfccd4f7e3117bc60434657bc005434ee3b4 Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Thu, 20 Nov 2014 22:02:32 +0100 Subject: [PATCH] create file and dirs before creating file --- .../java/eu/siacs/conversations/persistance/FileBackend.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java index 9683d38d2..7bac3fd0b 100644 --- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java @@ -149,6 +149,8 @@ public class FileBackend { String extension = MimeTypeMap.getSingleton().getExtensionFromMimeType(mime); message.setRelativeFilePath(message.getUuid() + "." + extension); DownloadableFile file = mXmppConnectionService.getFileBackend().getFile(message); + file.getParentFile().mkdirs(); + file.createNewFile(); OutputStream os = new FileOutputStream(file); InputStream is = mXmppConnectionService.getContentResolver().openInputStream(uri); byte[] buffer = new byte[1024];