diff --git a/Shuttle.xcodeproj/project.pbxproj b/Shuttle.xcodeproj/project.pbxproj index d174fef..a79150c 100644 --- a/Shuttle.xcodeproj/project.pbxproj +++ b/Shuttle.xcodeproj/project.pbxproj @@ -234,6 +234,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, "zh-Hans", Base, @@ -454,7 +455,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Shuttle/Shuttle-Prefix.pch"; INFOPLIST_FILE = "Shuttle/Shuttle-Info.plist"; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.13; PRODUCT_BUNDLE_IDENTIFIER = "shuttle.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; @@ -470,7 +471,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Shuttle/Shuttle-Prefix.pch"; INFOPLIST_FILE = "Shuttle/Shuttle-Info.plist"; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.13; PRODUCT_BUNDLE_IDENTIFIER = "shuttle.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; diff --git a/Shuttle/AppDelegate.m b/Shuttle/AppDelegate.m index 2f77935..d62063a 100644 --- a/Shuttle/AppDelegate.m +++ b/Shuttle/AppDelegate.m @@ -463,6 +463,22 @@ - (void) separatorSortRemoval:(NSString *)currentName { } } +// Determines whether a shuttle entry should be treated as a URL (e.g. vnc://, ssh://, +// http://) versus a shell command to run in Terminal/iTerm. A real URL never contains +// unescaped whitespace, so that's a more reliable signal than scheme alone: NSURL's +// parser has become considerably more lenient over time (and its exact behavior is +// gated on the SDK the binary is linked against), so plain shell commands like +// "ssh user@host" can now parse into a non-nil NSURL on current macOS/Xcode even +// though they never did in 2016. Checking for whitespace first avoids misrouting +// commands to -openURL: while still preserving legitimate scheme-based entries. +- (NSURL *) urlForEntry:(NSString *)entry { + if ([entry rangeOfCharacterFromSet:[NSCharacterSet whitespaceCharacterSet]].location != NSNotFound) { + return nil; + } + NSURL *url = [NSURL URLWithString:entry]; + return url.scheme.length ? url : nil; +} + - (void) openHost:(NSMenuItem *) sender { //NSLog(@"sender: %@", sender); //NSLog(@"Command: %@",[sender representedObject]); @@ -558,7 +574,7 @@ - (void) openHost:(NSMenuItem *) sender { NSURL *url; if ( ![terminalWindow isEqualToString:@"virtual"] ) { passParameters = @[escapedObject, terminalTheme, terminalTitle]; - url = [NSURL URLWithString:escapedObject]; + url = [self urlForEntry:escapedObject]; } else { passParameters = @[escapedObject, terminalTitle]; @@ -700,7 +716,11 @@ - (void) runScript:(NSString *)scriptPath handler:(NSString*)handlerName paramet [containerEvent setParamDescriptor:arguments forKeyword:keyDirectObject]; } //Execute the event - [appleScript executeAppleEvent:containerEvent error:nil]; + NSDictionary *executionError = nil; + [appleScript executeAppleEvent:containerEvent error:&executionError]; + if (executionError) { + NSLog(@"Shuttle AppleScript execution error for %@: %@", scriptPath, executionError); + } } }