Add ExternalStorageDirectoryPath

This commit is contained in:
Andrew Shini
2016-06-17 11:48:16 +10:00
parent 8377bafe72
commit e884fc2abc
3 changed files with 10 additions and 1 deletions
@@ -40,6 +40,7 @@ public class RNFSManager extends ReactContextBaseJavaModule {
private static final String NSDocumentDirectoryPath = "NSDocumentDirectoryPath";
private static final String NSExternalDirectoryPath = "NSExternalDirectoryPath";
private static final String NSExternalStorageDirectoryPath = "NSExternalStorageDirectoryPath";
private static final String NSPicturesDirectoryPath = "NSPicturesDirectoryPath";
private static final String NSTemporaryDirectoryPath = "NSTemporaryDirectoryPath";
private static final String NSCachesDirectoryPath = "NSCachesDirectoryPath";
@@ -345,6 +346,12 @@ public class RNFSManager extends ReactContextBaseJavaModule {
} else {
constants.put(NSExternalDirectoryPath, null);
}
File externalStorageDirectory = this.getReactApplicationContext().getExternalStorageDirectory(null);
if (externalStorageDirectory != null) {
constants.put(NSExternalStorageDirectoryPath, externalStorageDirectory.getAbsolutePath());
} else {
constants.put(NSExternalStorageDirectoryPath, null);
}
constants.put(NSPicturesDirectoryPath, Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsolutePath());
constants.put(NSCachesDirectoryPath, this.getReactApplicationContext().getCacheDir().getAbsolutePath());
constants.put(NSFileTypeRegular, 0);