File tree 1 file changed +38
-0
lines changed
1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 5
5
NSString * const TerminalNotifierBundleID = @" nl.superalloy.oss.terminal-notifier" ;
6
6
NSString * const NotificationCenterUIBundleID = @" com.apple.notificationcenterui" ;
7
7
8
+ // Set OS Params
9
+ #define NSAppKitVersionNumber10_8 1187
10
+ #define NSAppKitVersionNumber10_9 1265
11
+
8
12
NSString *_fakeBundleIdentifier = nil ;
9
13
10
14
@implementation NSBundle (FakeBundleIdentifier)
@@ -34,6 +38,18 @@ - (NSString *)__bundleIdentifier;
34
38
return NO ;
35
39
}
36
40
41
+ static BOOL
42
+ isMavericks ()
43
+ {
44
+ if (floor (NSAppKitVersionNumber ) <= NSAppKitVersionNumber10_8 )
45
+ {
46
+ /* On a 10.8 - 10.8.x system */
47
+ return NO ;
48
+ } else {
49
+ /* 10.9 or later system */
50
+ return YES ;
51
+ }
52
+ }
37
53
38
54
@implementation NSUserDefaults (SubscriptAndUnescape)
39
55
- (id )objectForKeyedSubscript : (id )key ;
@@ -49,6 +65,28 @@ - (id)objectForKeyedSubscript:(id)key;
49
65
50
66
@implementation AppDelegate
51
67
68
+ +(void )initializeUserDefaults
69
+ {
70
+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults ];
71
+
72
+ // initialize the dictionary with default values depending on OS level
73
+ NSDictionary *appDefaults;
74
+
75
+ if (isMavericks ())
76
+ {
77
+ // 10.9
78
+ appDefaults = @{@" sender" : @" com.apple.Terminal" };
79
+ }
80
+ else
81
+ {
82
+ // 10.8
83
+ appDefaults = @{@" " : @" message" };
84
+ }
85
+
86
+ // and set them appropriately
87
+ [defaults registerDefaults: appDefaults];
88
+ }
89
+
52
90
- (void )printHelpBanner ;
53
91
{
54
92
const char *appName = [[[NSBundle mainBundle ] objectForInfoDictionaryKey: @" CFBundleExecutable" ] UTF8String ];
You can’t perform that action at this time.
0 commit comments