Moved Android asset reading code path in NSData.

No reason to get path file system representation first.
This commit is contained in:
Frederik Seiffert 2019-05-24 09:28:10 +02:00
parent 3b60b1a8be
commit ba4948fd97

View file

@ -242,17 +242,6 @@ readContentsOfFile(NSString *path, void **buf, off_t *len, NSZone *zone)
void *tmp = 0;
int c;
off_t fileLength;
#if defined(_WIN32)
thePath = (const unichar*)[path fileSystemRepresentation];
#else
thePath = [path fileSystemRepresentation];
#endif
if (thePath == 0)
{
NSWarnFLog(@"Open (%@) attempt failed - bad path", path);
return NO;
}
#ifdef __ANDROID__
// Android: try using asset manager if path is in main bundle resources
@ -283,6 +272,17 @@ readContentsOfFile(NSString *path, void **buf, off_t *len, NSZone *zone)
}
#endif /* __ANDROID__ */
#if defined(_WIN32)
thePath = (const unichar*)[path fileSystemRepresentation];
#else
thePath = [path fileSystemRepresentation];
#endif
if (thePath == 0)
{
NSWarnFLog(@"Open (%@) attempt failed - bad path", path);
return NO;
}
att = [mgr fileAttributesAtPath: path traverseLink: YES];
if (nil == att)
{