Skip to content

Commit

Permalink
Merge pull request #84 from GhostlyDark/osx_library_path
Browse files Browse the repository at this point in the history
core_interface.c: Don't force macOS app bundle path
  • Loading branch information
richard42 authored Sep 10, 2024
2 parents 1a68327 + 1cab2e6 commit beddd15
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/core_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,19 +141,22 @@ m64p_error AttachCoreLib(const char *CoreLibFilepath)
#endif
/* for MacOS, look for the library in the Frameworks folder of the app bundle */
#if defined(__APPLE__)
CFBundleRef mainBundle = CFBundleGetMainBundle();
if (mainBundle != NULL)
if (rval != M64ERR_SUCCESS || CoreHandle == NULL)
{
CFURLRef frameworksURL = CFBundleCopyPrivateFrameworksURL(mainBundle);
if (frameworksURL != NULL)
CFBundleRef mainBundle = CFBundleGetMainBundle();
if (mainBundle != NULL)
{
char libPath[1024 + 32];
if (CFURLGetFileSystemRepresentation(frameworksURL, TRUE, (uint8_t *) libPath, 1024))
CFURLRef frameworksURL = CFBundleCopyPrivateFrameworksURL(mainBundle);
if (frameworksURL != NULL)
{
strcat(libPath, "/" OSAL_DEFAULT_DYNLIB_FILENAME);
rval = osal_dynlib_open(&CoreHandle, libPath);
char libPath[1024 + 32];
if (CFURLGetFileSystemRepresentation(frameworksURL, TRUE, (uint8_t *) libPath, 1024))
{
strcat(libPath, "/" OSAL_DEFAULT_DYNLIB_FILENAME);
rval = osal_dynlib_open(&CoreHandle, libPath);
}
CFRelease(frameworksURL);
}
CFRelease(frameworksURL);
}
}
#endif
Expand Down

0 comments on commit beddd15

Please sign in to comment.