create file and dirs before creating file
This commit is contained in:
parent
8fe3b2974b
commit
66abdfccd4
|
@ -149,6 +149,8 @@ public class FileBackend {
|
||||||
String extension = MimeTypeMap.getSingleton().getExtensionFromMimeType(mime);
|
String extension = MimeTypeMap.getSingleton().getExtensionFromMimeType(mime);
|
||||||
message.setRelativeFilePath(message.getUuid() + "." + extension);
|
message.setRelativeFilePath(message.getUuid() + "." + extension);
|
||||||
DownloadableFile file = mXmppConnectionService.getFileBackend().getFile(message);
|
DownloadableFile file = mXmppConnectionService.getFileBackend().getFile(message);
|
||||||
|
file.getParentFile().mkdirs();
|
||||||
|
file.createNewFile();
|
||||||
OutputStream os = new FileOutputStream(file);
|
OutputStream os = new FileOutputStream(file);
|
||||||
InputStream is = mXmppConnectionService.getContentResolver().openInputStream(uri);
|
InputStream is = mXmppConnectionService.getContentResolver().openInputStream(uri);
|
||||||
byte[] buffer = new byte[1024];
|
byte[] buffer = new byte[1024];
|
||||||
|
|
Loading…
Reference in a new issue