Browse Source

Merge branch '0.10.1' of github.com:wkh237/react-native-fetch-blob into 0.10.1

Ben Hsieh 8 years ago
parent
commit
c6e49fba3f

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

46
             path = path.replace("?append=true", "");
46
             path = path.replace("?append=true", "");
47
             mPath = path;
47
             mPath = path;
48
             File f = new File(path);
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
             if(f.exists() == false)
55
             if(f.exists() == false)
50
                 f.createNewFile();
56
                 f.createNewFile();
51
             ofStream = new FileOutputStream(new File(path), appendToExistingFile);
57
             ofStream = new FileOutputStream(new File(path), appendToExistingFile);