瀏覽代碼

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

Ben Hsieh 8 年之前
父節點
當前提交
c6e49fba3f
共有 1 個檔案被更改,包括 6 行新增0 行删除
  1. 6
    0
      src/android/src/main/java/com/RNFetchBlob/Response/RNFetchBlobFileResp.java

+ 6
- 0
src/android/src/main/java/com/RNFetchBlob/Response/RNFetchBlobFileResp.java 查看文件

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