Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.

Commit 4fb9da7

Browse files
blankgwkh237
authored andcommitted
Add support for the Library directory (iOS only) (#327)
1 parent 57bfea9 commit 4fb9da7

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

fs.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ const dirs = {
2929
DownloadDir : RNFetchBlob.DownloadDir,
3030
DCIMDir : RNFetchBlob.DCIMDir,
3131
SDCardDir : RNFetchBlob.SDCardDir,
32-
MainBundleDir : RNFetchBlob.MainBundleDir
32+
MainBundleDir : RNFetchBlob.MainBundleDir,
33+
LibraryDir : RNFetchBlob.LibraryDir
3334
}
3435

3536
/**

ios/RNFetchBlob/RNFetchBlob.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ - (NSDictionary *)constantsToExport
6666
return @{
6767
@"MainBundleDir" : [RNFetchBlobFS getMainBundleDir],
6868
@"DocumentDir": [RNFetchBlobFS getDocumentDir],
69-
@"CacheDir" : [RNFetchBlobFS getCacheDir]
69+
@"CacheDir" : [RNFetchBlobFS getCacheDir],
70+
@"LibraryDir" : [RNFetchBlobFS getLibraryDir]
7071
};
7172
}
7273

ios/RNFetchBlobFS.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
+ (NSString *) getTempPath;
5151
+ (NSString *) getCacheDir;
5252
+ (NSString *) getDocumentDir;
53+
+ (NSString *) getLibraryDir;
5354
+ (NSString *) getTempPath:(NSString*)taskId withExtension:(NSString *)ext;
5455
+ (NSString *) getPathOfAsset:(NSString *)assetURI;
5556
+ (void) getPathFromUri:(NSString *)uri completionHandler:(void(^)(NSString * path, ALAssetRepresentation *asset)) onComplete;

ios/RNFetchBlobFS.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ + (NSString *) getPictureDir {
114114
return [NSSearchPathForDirectoriesInDomains(NSPicturesDirectory, NSUserDomainMask, YES) firstObject];
115115
}
116116

117+
+ (NSString *) getLibraryDir {
118+
return [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) firstObject];
119+
}
120+
117121
+ (NSString *) getTempPath {
118122

119123
return NSTemporaryDirectory();

0 commit comments

Comments
 (0)