From ba4948fd97341c0fbd0575bb156405f72ed97c77 Mon Sep 17 00:00:00 2001 From: Frederik Seiffert Date: Fri, 24 May 2019 09:28:10 +0200 Subject: [PATCH] Moved Android asset reading code path in NSData. No reason to get path file system representation first. --- Source/NSData.m | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Source/NSData.m b/Source/NSData.m index 0140a8c8a..666b89c95 100644 --- a/Source/NSData.m +++ b/Source/NSData.m @@ -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) {