From c3f91e9ff31f2d62a0cc0401447339b7b66940c8 Mon Sep 17 00:00:00 2001 From: bjorn Date: Mon, 14 Oct 2019 15:24:02 -0700 Subject: [PATCH] Actually fix/test the issue with .lovr files on macOS apps; --- src/modules/filesystem/filesystem.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/modules/filesystem/filesystem.c b/src/modules/filesystem/filesystem.c index 62c5d929..358bdce3 100644 --- a/src/modules/filesystem/filesystem.c +++ b/src/modules/filesystem/filesystem.c @@ -48,15 +48,16 @@ static bool getBundlePath(char* buffer, size_t size) { id extension = objc_msgSend((id) objc_getClass("NSString"), sel_registerName("stringWithUTF8String:"), "lovr"); id bundle = objc_msgSend((id) objc_getClass("NSBundle"), sel_registerName("mainBundle")); id path = objc_msgSend(bundle, sel_registerName("pathForResource:ofType:"), nil, extension); - if (path == nil) { return false; } - char* cpath = NULL; - object_getInstanceVariable(path, "UTF8String", (void**) &cpath); - size_t length = strlen(cpath); + const char* cpath = (const char*) objc_msgSend(path, sel_registerName("UTF8String")); + if (!cpath) { + return false; + } + size_t length = strlen(cpath); if (length >= size) { return false; }