diff --git a/Classes/FanControl.m b/Classes/FanControl.m index 0508033..d31e759 100755 --- a/Classes/FanControl.m +++ b/Classes/FanControl.m @@ -52,18 +52,29 @@ +(void) initialize { //avoid Zombies when starting external app signal(SIGCHLD, SIG_IGN); - [FanControl copyMachinesIfNecessary]; //check owner and suid rights [FanControl setRights]; //talk to smc [smcWrapper init]; + [FanControl terminateIfNoFans]; + + [FanControl copyMachinesIfNecessary]; + //app in foreground for update notifications [[NSApplication sharedApplication] activateIgnoringOtherApps:YES]; } ++(void) terminateIfNoFans { + int fan_num = [smcWrapper get_fan_num]; + if (fan_num <= 0) { + NSLog(@"Exiting as %d fans were detected for Model Identifier: %@", fan_num, [MachineDefaults computerModel]); + [[NSApplication sharedApplication] terminate:self]; + } +} + +(void)copyMachinesIfNecessary { NSString *path = [[[NSFileManager defaultManager] applicationSupportDirectory] stringByAppendingPathComponent:@"Machines.plist"];