forked from cl3m/MiddleClick
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WakeObserver.m
23 lines (16 loc) · 638 Bytes
/
WakeObserver.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//
// WakeObserver.m
//
// Created by Clem on 18.10.09.
//
#import "WakeObserver.h"
@implementation WakeObserver
- (void) receiveWakeNote: (NSNotification*) note
{
[NSThread sleepForTimeInterval:10.0]; //wait 10 sec before restarting to be sure everthing is up
NSString *relaunch = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"relaunch"];
int procid = [[NSProcessInfo processInfo] processIdentifier];
[NSTask launchedTaskWithLaunchPath:relaunch arguments:[NSArray arrayWithObjects:[[NSBundle mainBundle] bundlePath], [NSString stringWithFormat:@"%d",procid], nil]];
[NSApp terminate:NULL];
}
@end