mirror of
https://github.com/status-im/react-native-image-resizer.git
synced 2025-01-11 23:24:30 +00:00
fix(ios): outputPath
on iOS can contain an absolute path
This commit is contained in:
parent
16505b771e
commit
3458ffedad
@ -42,7 +42,12 @@ NSString * generateFilePath(NSString * ext, NSString * outputPath)
|
||||
} else {
|
||||
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
||||
NSString *documentsDirectory = [paths objectAtIndex:0];
|
||||
directory = [documentsDirectory stringByAppendingPathComponent:outputPath];
|
||||
if ([outputPath hasPrefix:documentsDirectory]) {
|
||||
directory = outputPath;
|
||||
} else {
|
||||
directory = [documentsDirectory stringByAppendingPathComponent:outputPath];
|
||||
}
|
||||
|
||||
NSError *error;
|
||||
[[NSFileManager defaultManager] createDirectoryAtPath:directory withIntermediateDirectories:YES attributes:nil error:&error];
|
||||
if (error) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user