浏览代码

Add support for SDCards applications's directory (Android only) (#372)

Guy Blank 7 年前
父节点
当前提交
acf4aa5578
共有 2 个文件被更改,包括 4 次插入1 次删除
  1. 1
    0
      android/src/main/java/com/RNFetchBlob/RNFetchBlobFS.java
  2. 3
    1
      fs.js

+ 1
- 0
android/src/main/java/com/RNFetchBlob/RNFetchBlobFS.java 查看文件

@@ -203,6 +203,7 @@ public class RNFetchBlobFS {
203 203
         state = Environment.getExternalStorageState();
204 204
         if (state.equals(Environment.MEDIA_MOUNTED)) {
205 205
             res.put("SDCardDir", Environment.getExternalStorageDirectory().getAbsolutePath());
206
+            res.put("SDCardApplicationDir", ctx.getExternalFilesDir(null).getParentFile().getAbsolutePath());
206 207
         }
207 208
         res.put("MainBundleDir", ctx.getApplicationInfo().dataDir);
208 209
         return res;

+ 3
- 1
fs.js 查看文件

@@ -29,7 +29,9 @@ const dirs = {
29 29
     DownloadDir : RNFetchBlob.DownloadDir,
30 30
     DCIMDir : RNFetchBlob.DCIMDir,
31 31
     SDCardDir : RNFetchBlob.SDCardDir,
32
-    MainBundleDir : RNFetchBlob.MainBundleDir
32
+    SDCardApplicationDir : RNFetchBlob.SDCardApplicationDir,
33
+    MainBundleDir : RNFetchBlob.MainBundleDir,
34
+    LibraryDir : RNFetchBlob.LibraryDir
33 35
 }
34 36
 
35 37
 /**