Skip to content
Snippets Groups Projects
Commit 3a75cbad authored by neil's avatar neil
Browse files

Bundle-aware Mac version of getself

git-svn-id: http://svn.net-core.org/repos/t-engine4@612 51575b47-30f0-44d4-a5cc-537603b46e54
parent 8961cce2
No related branches found
No related tags found
No related merge requests found
#import <Cocoa/Cocoa.h>
const char *get_self_executable(int argc, char **argv)
{
static char *cstr = 0;
if(!cstr)
{
NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
resourcePath = [NSString stringWithFormat:@"%@/", resourcePath];
const char *utf8 = [resourcePath UTF8String];
cstr = malloc(strlen(utf8) + 1);
strcpy(cstr, utf8);
}
return cstr;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment