forked from boredzo/ImageOptim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.m
More file actions
26 lines (21 loc) · 615 Bytes
/
Copy pathmain.m
File metadata and controls
26 lines (21 loc) · 615 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//
// Created by porneL on 7.wrz.07.
//
int quitWhenDone = 0;
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
static int isLaunchedWithCliArguments(int argc, char *argv[]) {
// Unfortunately NSApplicationLaunchIsDefaultLaunchKey doesn't cover bare CLI launch
if (argc < 2) return 0;
for(int i=0; i < argc; i++) {
if ('-' == argv[i][0]) { // Normal OS X launch sets -psn
return 0;
}
}
return 1;
}
int main(int argc, char *argv[])
{
quitWhenDone = isLaunchedWithCliArguments(argc, argv);
return NSApplicationMain(argc, (const char **) argv);
}