ddnet/src/macoslaunch/client.m
def e985632fae OSX -> macOS
Changing the filenames of the releases will be a bit more annoying, so
not sure we want to do that
2021-02-12 13:41:41 +01:00

24 lines
516 B
Objective-C

#import <Cocoa/Cocoa.h>
#include <base/system.h>
extern int TWMain(int argc, const char **argv);
int main(int argc, const char **argv)
{
BOOL FinderLaunch = argc >= 2 && !str_comp_num(argv[1], "-psn", 4);
NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
if(!resourcePath)
return -1;
[[NSFileManager defaultManager] changeCurrentDirectoryPath:resourcePath];
if(FinderLaunch)
{
const char *paArgv[2] = { argv[0], NULL };
return TWMain(1, paArgv);
}
else
return TWMain(argc, argv);
}