Adding base tooling for macOS bundles, and DYLD_LIBRARY_PATH bypass

This commit is contained in:
2026-03-18 15:19:28 +10:00
parent 42e67d30bc
commit d00cf292f1
4 changed files with 171 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
/*
* OpenSubSonicPlayer Launcher
* Goldenkrew3000 2026
* License: GNU General Public License 3.0
* Darwin XNU / macOS OSSP Bundle Launcher
* INFO: macOS doesn't seem to allow usage of mach-o/dyld.h from C++
*/
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <limits.h>
#include <mach-o/dyld.h>
int dyld_get_executable_path(char** path) {
char* macho_path[PATH_MAX];
uint32_t macho_path_sz = sizeof(macho_path);
int dyld_rc = 0;
dyld_rc = _NSGetExecutablePath(macho_path, &macho_path_sz);
if (dyld_rc != 0) {
return 1;
}
*path = malloc(PATH_MAX);
if (*path == NULL) {
return 1;
}
memcpy(*path, macho_path, strlen(macho_path));
return 0;
}