Przeglądaj źródła

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

Guy Blank 7 lat temu
rodzic
commit
acf4aa5578

+ 1
- 0
android/src/main/java/com/RNFetchBlob/RNFetchBlobFS.java Wyświetl plik

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 Wyświetl plik

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