|
@@ -289,16 +289,27 @@ RCT_EXPORT_METHOD(lstat:(NSString *)path callback:(RCTResponseSenderBlock) callb
|
289
|
289
|
|
290
|
290
|
}
|
291
|
291
|
|
292
|
|
-RCT_EXPORT_METHOD(cp:(NSString *)path toPath:(NSString *)dest callback:(RCTResponseSenderBlock) callback) {
|
293
|
|
- NSError * error = nil;
|
294
|
|
- path = [RNFetchBlobFS getPathOfAsset:path];
|
295
|
|
- BOOL result = [[NSFileManager defaultManager] copyItemAtURL:[NSURL fileURLWithPath:path] toURL:[NSURL fileURLWithPath:dest] error:&error];
|
296
|
|
-
|
297
|
|
- if(error == nil)
|
298
|
|
- callback(@[[NSNull null], @YES]);
|
299
|
|
- else
|
300
|
|
- callback(@[[error localizedDescription], @NO]);
|
301
|
|
-
|
|
292
|
+RCT_EXPORT_METHOD(cp:(NSString*)src toPath:(NSString *)dest callback:(RCTResponseSenderBlock) callback) {
|
|
293
|
+
|
|
294
|
+// path = [RNFetchBlobFS getPathOfAsset:path];
|
|
295
|
+ [RNFetchBlobFS getPathFromUri:src completionHandler:^(NSString *path, ALAssetRepresentation *asset) {
|
|
296
|
+ NSError * error = nil;
|
|
297
|
+ if(path == nil)
|
|
298
|
+ {
|
|
299
|
+ [RNFetchBlobFS writeAssetToPath:asset dest:dest];
|
|
300
|
+ callback(@[[NSNull null], @YES]);
|
|
301
|
+ }
|
|
302
|
+ else
|
|
303
|
+ {
|
|
304
|
+ BOOL result = [[NSFileManager defaultManager] copyItemAtURL:[NSURL fileURLWithPath:path] toURL:[NSURL fileURLWithPath:dest] error:&error];
|
|
305
|
+
|
|
306
|
+ if(error == nil)
|
|
307
|
+ callback(@[[NSNull null], @YES]);
|
|
308
|
+ else
|
|
309
|
+ callback(@[[error localizedDescription], @NO]);
|
|
310
|
+ }
|
|
311
|
+ }];
|
|
312
|
+
|
302
|
313
|
}
|
303
|
314
|
|
304
|
315
|
RCT_EXPORT_METHOD(mv:(NSString *)path toPath:(NSString *)dest callback:(RCTResponseSenderBlock) callback) {
|