create file and dirs before creating file

This commit is contained in:
iNPUTmice 2014-11-20 22:02:32 +01:00
parent 8fe3b2974b
commit 66abdfccd4

View file

@ -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];