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
32 lines (26 loc) · 920 Bytes
/
main.m
File metadata and controls
32 lines (26 loc) · 920 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
28
29
30
31
32
//
// 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);
if (NSAppKitVersionNumber < NSAppKitVersionNumber10_10 && ![NSVisualEffectView class]) {
Class NSVisualEffectViewClass = objc_allocateClassPair([NSView class], "NSVisualEffectView", 0);
objc_registerClassPair(NSVisualEffectViewClass);
}
return NSApplicationMain(argc, (const char **) argv);
}