Added Cache and Document directory paths as constants
This commit is contained in:
parent
1821893891
commit
78f5272521
|
@ -52,7 +52,9 @@ var RNFS = {
|
|||
|
||||
MainBundle: RNFSManager.MainBundleDirectory,
|
||||
CachesDirectory: RNFSManager.NSCachesDirectory,
|
||||
DocumentDirectory: RNFSManager.NSDocumentDirectory
|
||||
DocumentDirectory: RNFSManager.NSDocumentDirectory,
|
||||
CachesDirectoryPath: RNFSManager.NSCachesDirectoryPath,
|
||||
DocumentDirectoryPath: RNFSManager.NSDocumentDirectoryPath
|
||||
};
|
||||
|
||||
module.exports = RNFS;
|
||||
|
|
|
@ -91,9 +91,16 @@ RCT_EXPORT_METHOD(readFile:(NSString*)filepath callback:(RCTResponseSenderBlock)
|
|||
}];
|
||||
}
|
||||
|
||||
- (NSString*) getPathForDirectory:(int)directory {
|
||||
NSArray *paths = NSSearchPathForDirectoriesInDomains(directory, NSUserDomainMask, YES);
|
||||
return [paths objectAtIndex:0];
|
||||
}
|
||||
|
||||
- (NSDictionary *)constantsToExport
|
||||
{
|
||||
return @{
|
||||
@"NSCachesDirectoryPath": [self getPathForDirectory:NSCachesDirectory],
|
||||
@"NSDocumentDirectoryPath": [self getPathForDirectory:NSDocumentDirectory],
|
||||
@"NSCachesDirectory": [NSNumber numberWithInteger:NSCachesDirectory],
|
||||
@"NSDocumentDirectory": [NSNumber numberWithInteger:NSDocumentDirectory],
|
||||
@"MainBundleDirectory": [NSNumber numberWithInteger:MainBundleDirectory],
|
||||
|
|
Loading…
Reference in New Issue