diff --git a/src/mcu.cpp b/src/mcu.cpp index 50ca007..b73026f 100644 --- a/src/mcu.cpp +++ b/src/mcu.cpp @@ -51,6 +51,10 @@ #include #endif +#if defined(__APPLE__) +#include +#endif + const char* rs_name[ROM_SET_COUNT] = { "SC-55mk2", "SC-55st", @@ -1489,23 +1493,28 @@ int main(int argc, char *argv[]) } } -#if __linux__ +#if __linux__ || __APPLE__ char self_path[PATH_MAX]; memset(&self_path[0], 0, PATH_MAX); +#if __linux__ if(readlink("/proc/self/exe", self_path, PATH_MAX) == -1) +#else + uint32_t path_max_size = PATH_MAX; + if(_NSGetExecutablePath(self_path, &path_max_size) == -1) +#endif basePath = Files::real_dirname(argv[0]); else - basePath = Files::dirname(self_path); + basePath = Files::real_dirname(self_path); #else basePath = Files::real_dirname(argv[0]); #endif - printf("Base path is: %s\n", argv[0]); - if(Files::dirExists(basePath + "/../share/nuked-sc55")) basePath += "/../share/nuked-sc55"; + printf("Base path is: %s\n", basePath.c_str()); + if (autodetect) { for (size_t i = 0; i < ROM_SET_COUNT; i++)