forked from ImageOptim/ImageOptim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.m
More file actions
27 lines (22 loc) · 659 Bytes
/
Copy pathmain.m
File metadata and controls
27 lines (22 loc) · 659 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
27
//
// Created by porneL on 7.wrz.07.
//
int quitWhenDone = 0;
#import "log.h"
#import <Foundation/Foundation.h>
@import Cocoa;
#import <objc/runtime.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 = hideLogs = isLaunchedWithCliArguments(argc, argv);
return NSApplicationMain(argc, (const char **)argv);
}