浏览代码

Fix Android SDCard path constant #174

Ben Hsieh 8 年前
父节点
当前提交
e086e9a054
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5
    1
      src/android/src/main/java/com/RNFetchBlob/RNFetchBlobFS.java

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

@@ -197,7 +197,11 @@ public class RNFetchBlobFS {
197 197
         res.put("DownloadDir", Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath());
198 198
         res.put("MovieDir", Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES).getAbsolutePath());
199 199
         res.put("RingtoneDir", Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_RINGTONES).getAbsolutePath());
200
-//        res.put("SDCard", Environment.getExternalStorageDirectory().getAbsolutePath());
200
+        String state;
201
+        state = Environment.getExternalStorageState();
202
+        if (state.equals(Environment.MEDIA_MOUNTED)) {
203
+            res.put("SDCard", Environment.getExternalStorageDirectory().getAbsolutePath());
204
+        }
201 205
         res.put("MainBundleDir", ctx.getApplicationInfo().dataDir);
202 206
         return res;
203 207
     }