Skip to content

Commit f0a6d6c

Browse files
author
Preben Ludviksen
committed
Added method absolutePath:inStorage
1 parent fd6a060 commit f0a6d6c

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

ios/RNFileSystem/RNFileSystem.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ extern NSString *const STORAGE_TEMPORARY;
1313
+ (BOOL)fileExists:(NSString*)relativePath inStorage:(NSString*)storage;
1414
+ (BOOL)directoryExists:(NSString*)relativePath inStorage:(NSString*)storage;
1515
+ (BOOL)deleteFileOrDirectory:(NSString*)relativePath inStorage:(NSString*)storage;
16+
+ (NSString*)absolutePath:(NSString*)relativePath inStorage:(NSString*)storage;
1617

1718
// Extra method for integration from other modules / native code
1819
+ (NSString*)moveFileFromUrl:(NSURL*)location toRelativePath:(NSString*)relativePath inStorage:(NSString*)storage;

ios/RNFileSystem/RNFileSystem.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ + (BOOL)addSkipBackupAttributeToItemAtPath:(NSString *) filePathString
9696
return success;
9797
}
9898

99+
+ (NSString*)absolutePath:(NSString*)relativePath inStorage:(NSString*)storage {
100+
NSURL *baseDir = [RNFileSystem baseDirForStorage:storage];
101+
return [[baseDir URLByAppendingPathComponent:relativePath] path];
102+
}
103+
99104
// Extra method for integration from other modules / native code
100105
+ (NSString*)moveFileFromUrl:(NSURL*)location toRelativePath:(NSString*)relativePath inStorage:(NSString*)storage {
101106
NSFileManager *fileManager = [NSFileManager defaultManager];

0 commit comments

Comments
 (0)