Browse Source

Add main bundle folder constant #138

Ben Hsieh 8 years ago
parent
commit
21fd76c8bd

+ 1
- 1
src/android/src/main/java/com/RNFetchBlob/RNFetchBlobFS.java View File

194
         try {
194
         try {
195
             p = m.getPackageInfo(s, 0);
195
             p = m.getPackageInfo(s, 0);
196
             s = p.applicationInfo.dataDir;
196
             s = p.applicationInfo.dataDir;
197
-            res.put("DocumentDir", s);
197
+            res.put("MainBundleDir", s);
198
         } catch (PackageManager.NameNotFoundException e) {
198
         } catch (PackageManager.NameNotFoundException e) {
199
             e.printStackTrace();
199
             e.printStackTrace();
200
         }
200
         }

+ 1
- 0
src/ios/RNFetchBlobFS.h View File

39
 @property (nonatomic) BOOL appendData;
39
 @property (nonatomic) BOOL appendData;
40
 
40
 
41
 // get dirs
41
 // get dirs
42
++ (NSString *) getMainBundleDir;
42
 + (NSString *) getTempPath;
43
 + (NSString *) getTempPath;
43
 + (NSString *) getCacheDir;
44
 + (NSString *) getCacheDir;
44
 + (NSString *) getDocumentDir;
45
 + (NSString *) getDocumentDir;

+ 1
- 1
src/ios/RNFetchBlobFS.m View File

111
 
111
 
112
 + (NSString *) getTempPath {
112
 + (NSString *) getTempPath {
113
     
113
     
114
-    return [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingString:@"/RNFetchBlob_tmp"];
114
+    return NSTemporaryDirectory();
115
 }
115
 }
116
 
116
 
117
 + (NSString *) getTempPath:(NSString*)taskId withExtension:(NSString *)ext {
117
 + (NSString *) getTempPath:(NSString*)taskId withExtension:(NSString *)ext {