mirror of
https://github.com/status-im/react-native.git
synced 2025-02-26 16:10:58 +00:00
[ReactNative] Reverted D1986572
This commit is contained in:
parent
f8beaa5dde
commit
03a54c56f9
@ -58,14 +58,18 @@ RCT_CONVERTER(NSString *, NSString, description)
|
|||||||
|
|
||||||
+ (NSURL *)NSURL:(id)json
|
+ (NSURL *)NSURL:(id)json
|
||||||
{
|
{
|
||||||
NSString *path = [self NSString:json];
|
if (![json isKindOfClass:[NSString class]]) {
|
||||||
|
RCTLogError(@"Expected NSString for NSURL, received %@: %@", [json classForCoder], json);
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSString *path = json;
|
||||||
if ([path isAbsolutePath])
|
if ([path isAbsolutePath])
|
||||||
{
|
{
|
||||||
return [NSURL fileURLWithPath:path];
|
return [NSURL fileURLWithPath:path];
|
||||||
}
|
}
|
||||||
else if ([path length])
|
else if ([path length])
|
||||||
{
|
{
|
||||||
path = [path stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
|
||||||
NSURL *URL = [NSURL URLWithString:path relativeToURL:[[NSBundle mainBundle] resourceURL]];
|
NSURL *URL = [NSURL URLWithString:path relativeToURL:[[NSBundle mainBundle] resourceURL]];
|
||||||
if ([URL isFileURL] && ![[NSFileManager defaultManager] fileExistsAtPath:[URL path]]) {
|
if ([URL isFileURL] && ![[NSFileManager defaultManager] fileExistsAtPath:[URL path]]) {
|
||||||
RCTLogWarn(@"The file '%@' does not exist", URL);
|
RCTLogWarn(@"The file '%@' does not exist", URL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user