I'm trying to get the current executable's file path without the executable name at the end.
I'm doing:
uint32_t size = sizeof(path);
if (_NSGetExecutablePath(path, &size) == 0) {
}
else {
printf("buffer too small; need size %u\n", size);
}
char* program_name = dirname(path); // To remove executable name from the path
It works the path output is: /Users/Me/Desktop/TNT/build/Debug/
But when i was going to add some gui by using SDL library, the output path was wrong:
/Users/Me/Desktop/TNT/build/Debug/TNT.app/