ddnet/src/macoslaunch/client.m

24 lines
516 B
Mathematica
Raw Normal View History

2020-03-27 23:18:24 +00:00
#import <Cocoa/Cocoa.h>
#include <base/system.h>
2008-10-21 15:59:32 +00:00
2020-03-27 23:18:24 +00:00
extern int TWMain(int argc, const char **argv);
2008-10-21 15:59:32 +00:00
2020-03-27 23:18:24 +00:00
int main(int argc, const char **argv)
2008-10-21 15:59:32 +00:00
{
2020-03-27 23:18:24 +00:00
BOOL FinderLaunch = argc >= 2 && !str_comp_num(argv[1], "-psn", 4);
2008-10-21 15:59:32 +00:00
NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
2020-03-27 23:18:24 +00:00
if(!resourcePath)
return -1;
2020-03-27 23:18:24 +00:00
[[NSFileManager defaultManager] changeCurrentDirectoryPath:resourcePath];
2020-03-27 23:18:24 +00:00
if(FinderLaunch)
{
2020-03-27 23:18:24 +00:00
const char *paArgv[2] = { argv[0], NULL };
return TWMain(1, paArgv);
}
2020-03-27 23:18:24 +00:00
else
return TWMain(argc, argv);
2008-10-21 15:59:32 +00:00
}