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
1 changed files with 2 additions and 0 deletions

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