Permalink
Browse files

Refactor [EyeTunes isRunning] to be much simpler

  • Loading branch information...
clee authored and Kaspars Dancis committed Apr 30, 2011
1 parent ef90006 commit d5d56387236362e32df0ea33168a2297ce91a27a
Showing with 1 addition and 11 deletions.
  1. +1 −11 ETEyeTunes.m
View
@@ -67,17 +67,7 @@ + (void)quit{
}
+ (BOOL)isRunning{
- //TODO: It is strongly suggested that you use the NSWorkspace runningApplications method and the NSRunningApplication class to retrieve this information in applications targeted for Mac OS X v10.6 and later.
- NSInteger i;
- NSArray *apps = [[NSWorkspace sharedWorkspace] launchedApplications];
- for(i=0; i<[apps count]; ++i){
- NSDictionary *app = [apps objectAtIndex:i];
- NSString *bundleIdentifier = [app objectForKey:@"NSApplicationBundleIdentifier"];
- if([bundleIdentifier isEqualToString:@"com.apple.iTunes"]){
- return YES;
- }
- }
- return NO;
+ return ([[NSRunningApplication runningApplicationsWithBundleIdentifier:@"com.apple.iTunes"] count] > 0);
}
#pragma mark -

0 comments on commit d5d5638

Please sign in to comment.