Browse Source

Merge pull request #184 from chrissloey/0.10.1

Fix Android file saving bug
wkh237 8 years ago
parent
commit
4d95709271

+ 6
- 0
src/android/src/main/java/com/RNFetchBlob/Response/RNFetchBlobFileResp.java View File

@@ -46,6 +46,12 @@ public class RNFetchBlobFileResp extends ResponseBody {
46 46
             path = path.replace("?append=true", "");
47 47
             mPath = path;
48 48
             File f = new File(path);
49
+
50
+            File parent = f.getParentFile();
51
+            if(!parent.exists() && !parent.mkdirs()){
52
+                throw new IllegalStateException("Couldn't create dir: " + parent);
53
+            }
54
+
49 55
             if(f.exists() == false)
50 56
                 f.createNewFile();
51 57
             ofStream = new FileOutputStream(new File(path), appendToExistingFile);