This commit is contained in:
Mike Grabowski 2016-05-14 23:42:57 +02:00
parent 7bf7c0bca1
commit bdeda5ef36
3 changed files with 5 additions and 2 deletions

View File

@ -196,7 +196,7 @@ var RNFS = {
CachesDirectoryPath: RNFSManager.NSCachesDirectoryPath, CachesDirectoryPath: RNFSManager.NSCachesDirectoryPath,
DocumentDirectoryPath: RNFSManager.NSDocumentDirectoryPath, DocumentDirectoryPath: RNFSManager.NSDocumentDirectoryPath,
ExternalDirectoryPath: RNFSManager.NSExternalDirectoryPath, ExternalDirectoryPath: RNFSManager.NSExternalDirectoryPath,
TemporaryDirectoryPathIOS: RNFSManager.NSTemporaryDirectoryPath, TemporaryDirectoryPath: RNFSManager.NSTemporaryDirectoryPath,
LibraryDirectoryPath: RNFSManager.NSLibraryDirectoryPath, LibraryDirectoryPath: RNFSManager.NSLibraryDirectoryPath,
PicturesDirectoryPath: RNFSManager.NSPicturesDirectoryPath PicturesDirectoryPath: RNFSManager.NSPicturesDirectoryPath
}; };

View File

@ -186,6 +186,7 @@ The following constants are available on the `RNFS` export:
`MainBundlePath` (`String`) The absolute path to the main bundle directory `MainBundlePath` (`String`) The absolute path to the main bundle directory
`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)
`ExternalDirectoryPath` (`String`) The absolute path to the external, shared directory (android only) `ExternalDirectoryPath` (`String`) The absolute path to the external, shared directory (android only)
### `promise readDir(path)` ### `promise readDir(path)`

View File

@ -41,6 +41,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 NSPicturesDirectoryPath = "NSPicturesDirectoryPath"; private static final String NSPicturesDirectoryPath = "NSPicturesDirectoryPath";
private static final String NSTemporaryDirectoryPath = "NSTemporaryDirectoryPath";
private static final String NSCachesDirectoryPath = "NSCachesDirectoryPath"; private static final String NSCachesDirectoryPath = "NSCachesDirectoryPath";
private static final String NSDocumentDirectory = "NSDocumentDirectory"; private static final String NSDocumentDirectory = "NSDocumentDirectory";
@ -332,6 +333,7 @@ public class RNFSManager extends ReactContextBaseJavaModule {
final Map<String, Object> constants = new HashMap<>(); final Map<String, Object> constants = new HashMap<>();
constants.put(NSDocumentDirectory, 0); constants.put(NSDocumentDirectory, 0);
constants.put(NSDocumentDirectoryPath, this.getReactApplicationContext().getFilesDir().getAbsolutePath()); constants.put(NSDocumentDirectoryPath, this.getReactApplicationContext().getFilesDir().getAbsolutePath());
constants.put(NSTemporaryDirectoryPath, null)
File externalDirectory = this.getReactApplicationContext().getExternalFilesDir(null); File externalDirectory = this.getReactApplicationContext().getExternalFilesDir(null);
if (externalDirectory != null) { if (externalDirectory != null) {
constants.put(NSExternalDirectoryPath, externalDirectory.getAbsolutePath()); constants.put(NSExternalDirectoryPath, externalDirectory.getAbsolutePath());