Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions src/mcu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
#include <limits.h>
#endif

#if defined(__APPLE__)
#include <mach-o/dyld.h>
#endif

const char* rs_name[ROM_SET_COUNT] = {
"SC-55mk2",
"SC-55st",
Expand Down Expand Up @@ -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++)
Expand Down