Created
March 26, 2012 11:56
Revisions
-
cdfmr created this gist
Mar 26, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ @implementation NSApplication (Relaunch) - (void)relaunchAfterDelay:(float)seconds { NSTask *task = [[[NSTask alloc] init] autorelease]; NSMutableArray *args = [NSMutableArray array]; [args addObject:@"-c"]; [args addObject:[NSString stringWithFormat:@"sleep %f; open \"%@\"", seconds, [[NSBundle mainBundle] bundlePath]]]; [task setLaunchPath:@"/bin/sh"]; [task setArguments:args]; [task launch]; [self terminate:nil]; } @end