From 3106403a86b306d652c38fda9ac19b8aa0e24bae Mon Sep 17 00:00:00 2001 From: serso Date: Tue, 15 Mar 2016 17:46:08 +0100 Subject: [PATCH] Fix missing directories --- app/src/main/java/org/solovyev/android/io/FileSaver.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/org/solovyev/android/io/FileSaver.java b/app/src/main/java/org/solovyev/android/io/FileSaver.java index 9eebcf47..0657d8ba 100644 --- a/app/src/main/java/org/solovyev/android/io/FileSaver.java +++ b/app/src/main/java/org/solovyev/android/io/FileSaver.java @@ -24,6 +24,10 @@ public class FileSaver extends BaseIoSaver { @NonNull protected FileOutputStream getOutputStream() throws FileNotFoundException { + final File dir = file.getParentFile(); + if (dir != null && !dir.exists()) { + dir.mkdirs(); + } return new FileOutputStream(file); } }