Browse Source

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

Guy Blank 7 years ago
parent
commit
acf4aa5578
2 changed files with 4 additions and 1 deletions
  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 View File

@@ -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 View File

@@ -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
 /**