Mac uninstaller: fix incompatibility with OS 10.6

This commit is contained in:
Charlie Fenton 2017-07-15 05:07:49 -07:00
parent a909b421e4
commit ff355b7a6c
1 changed files with 8 additions and 3 deletions

View File

@ -50,9 +50,14 @@ void BringAppWithPidToFront(pid_t pid) {
void getFrontMostApp(char * appName, size_t maxLen) {
NSRunningApplication * frontApp = [[NSWorkspace sharedWorkspace] frontmostApplication];
NSString * name = [frontApp localizedName];
strlcpy(appName, [name UTF8String], maxLen);
if ([[NSWorkspace sharedWorkspace] respondsToSelector: @selector(frontmostApplication)]){
NSRunningApplication * frontApp = [[NSWorkspace sharedWorkspace] frontmostApplication];
NSString * name = [frontApp localizedName];
strlcpy(appName, [name UTF8String], maxLen);
} else {
// NSWorkspace frontmostApplication is not available in OS 10.6
strlcpy(appName, "UserNotificationCenter", maxLen);
}
}