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
         state = Environment.getExternalStorageState();
203
         state = Environment.getExternalStorageState();
204
         if (state.equals(Environment.MEDIA_MOUNTED)) {
204
         if (state.equals(Environment.MEDIA_MOUNTED)) {
205
             res.put("SDCardDir", Environment.getExternalStorageDirectory().getAbsolutePath());
205
             res.put("SDCardDir", Environment.getExternalStorageDirectory().getAbsolutePath());
206
+            res.put("SDCardApplicationDir", ctx.getExternalFilesDir(null).getParentFile().getAbsolutePath());
206
         }
207
         }
207
         res.put("MainBundleDir", ctx.getApplicationInfo().dataDir);
208
         res.put("MainBundleDir", ctx.getApplicationInfo().dataDir);
208
         return res;
209
         return res;

+ 3
- 1
fs.js View File

29
     DownloadDir : RNFetchBlob.DownloadDir,
29
     DownloadDir : RNFetchBlob.DownloadDir,
30
     DCIMDir : RNFetchBlob.DCIMDir,
30
     DCIMDir : RNFetchBlob.DCIMDir,
31
     SDCardDir : RNFetchBlob.SDCardDir,
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
 /**