Skip to content

Commit a82012e

Browse files
author
Preben Ludviksen
committed
Made moveFileFromUrl return the absolute path of the new location (so that f.ex. an image file can be passed on to the Image-component)
1 parent 5b44552 commit a82012e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

ios/RNFileSystem/RNFileSystem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ extern NSString *const STORAGE_TEMPORARY;
1515
+ (BOOL)deleteFileOrDirectory:(NSString*)relativePath inStorage:(NSString*)storage;
1616

1717
// Extra method for integration from other modules / native code
18-
+ (void)moveFileFromUrl:(NSURL*)location toRelativePath:(NSString*)relativePath inStorage:(NSString*)storage;
18+
+ (NSString*)moveFileFromUrl:(NSURL*)location toRelativePath:(NSString*)relativePath inStorage:(NSString*)storage;
1919

2020
@end

ios/RNFileSystem/RNFileSystem.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ + (BOOL)addSkipBackupAttributeToItemAtPath:(NSString *) filePathString
9797
}
9898

9999
// Extra method for integration from other modules / native code
100-
+ (void)moveFileFromUrl:(NSURL*)location toRelativePath:(NSString*)relativePath inStorage:(NSString*)storage {
100+
+ (NSString*)moveFileFromUrl:(NSURL*)location toRelativePath:(NSString*)relativePath inStorage:(NSString*)storage {
101101
NSFileManager *fileManager = [NSFileManager defaultManager];
102102
NSURL *baseDir = [RNFileSystem baseDirForStorage:storage];
103103
NSURL *fullPath = [baseDir URLByAppendingPathComponent:relativePath];
@@ -106,6 +106,7 @@ + (void)moveFileFromUrl:(NSURL*)location toRelativePath:(NSString*)relativePath
106106
if ([storage isEqual:STORAGE_IMPORTANT]) {
107107
[RNFileSystem addSkipBackupAttributeToItemAtPath:[fullPath path]];
108108
}
109+
return [fullPath path];
109110
}
110111

111112
RCT_EXPORT_MODULE()

0 commit comments

Comments
 (0)