Add ExternalStorageDirectoryPath
This commit is contained in:
parent
8377bafe72
commit
e884fc2abc
|
@ -250,6 +250,7 @@ var RNFS = {
|
||||||
CachesDirectoryPath: RNFSManager.NSCachesDirectoryPath,
|
CachesDirectoryPath: RNFSManager.NSCachesDirectoryPath,
|
||||||
DocumentDirectoryPath: RNFSManager.NSDocumentDirectoryPath,
|
DocumentDirectoryPath: RNFSManager.NSDocumentDirectoryPath,
|
||||||
ExternalDirectoryPath: RNFSManager.NSExternalDirectoryPath,
|
ExternalDirectoryPath: RNFSManager.NSExternalDirectoryPath,
|
||||||
|
ExternalStorageDirectoryPath: RNFSManager.NSExternalStorageDirectoryPath,
|
||||||
TemporaryDirectoryPath: RNFSManager.NSTemporaryDirectoryPath,
|
TemporaryDirectoryPath: RNFSManager.NSTemporaryDirectoryPath,
|
||||||
LibraryDirectoryPath: RNFSManager.NSLibraryDirectoryPath,
|
LibraryDirectoryPath: RNFSManager.NSLibraryDirectoryPath,
|
||||||
PicturesDirectoryPath: RNFSManager.NSPicturesDirectoryPath
|
PicturesDirectoryPath: RNFSManager.NSPicturesDirectoryPath
|
||||||
|
|
|
@ -249,7 +249,8 @@ The following constants are available on the `RNFS` export:
|
||||||
- `CachesDirectoryPath` (`String`) The absolute path to the caches directory
|
- `CachesDirectoryPath` (`String`) The absolute path to the caches directory
|
||||||
- `DocumentDirectoryPath` (`String`) The absolute path to the document directory
|
- `DocumentDirectoryPath` (`String`) The absolute path to the document directory
|
||||||
- `TemporaryDirectoryPath` (`String`) The absolute path to the temporary directory (iOS only)
|
- `TemporaryDirectoryPath` (`String`) The absolute path to the temporary directory (iOS only)
|
||||||
- `ExternalDirectoryPath` (`String`) The absolute path to the external, shared directory (android only)
|
- `ExternalDirectoryPath` (`String`) The absolute path to the external files, shared directory (android only)
|
||||||
|
- `ExternalStorageDirectoryPath` (`String`) The absolute path to the external storage, shared directory (android only)
|
||||||
|
|
||||||
### `promise readDir(path)`
|
### `promise readDir(path)`
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ public class RNFSManager extends ReactContextBaseJavaModule {
|
||||||
|
|
||||||
private static final String NSDocumentDirectoryPath = "NSDocumentDirectoryPath";
|
private static final String NSDocumentDirectoryPath = "NSDocumentDirectoryPath";
|
||||||
private static final String NSExternalDirectoryPath = "NSExternalDirectoryPath";
|
private static final String NSExternalDirectoryPath = "NSExternalDirectoryPath";
|
||||||
|
private static final String NSExternalStorageDirectoryPath = "NSExternalStorageDirectoryPath";
|
||||||
private static final String NSPicturesDirectoryPath = "NSPicturesDirectoryPath";
|
private static final String NSPicturesDirectoryPath = "NSPicturesDirectoryPath";
|
||||||
private static final String NSTemporaryDirectoryPath = "NSTemporaryDirectoryPath";
|
private static final String NSTemporaryDirectoryPath = "NSTemporaryDirectoryPath";
|
||||||
private static final String NSCachesDirectoryPath = "NSCachesDirectoryPath";
|
private static final String NSCachesDirectoryPath = "NSCachesDirectoryPath";
|
||||||
|
@ -345,6 +346,12 @@ public class RNFSManager extends ReactContextBaseJavaModule {
|
||||||
} else {
|
} else {
|
||||||
constants.put(NSExternalDirectoryPath, null);
|
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(NSPicturesDirectoryPath, Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsolutePath());
|
||||||
constants.put(NSCachesDirectoryPath, this.getReactApplicationContext().getCacheDir().getAbsolutePath());
|
constants.put(NSCachesDirectoryPath, this.getReactApplicationContext().getCacheDir().getAbsolutePath());
|
||||||
constants.put(NSFileTypeRegular, 0);
|
constants.put(NSFileTypeRegular, 0);
|
||||||
|
|
Loading…
Reference in New Issue