Skip to content

Instantly share code, notes, and snippets.

@ysmood
Created June 24, 2013 18:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ysmood/5852409 to your computer and use it in GitHub Desktop.
Save ysmood/5852409 to your computer and use it in GitHub Desktop.
Example: Cocoa launch application via path.
+ (void) launchApp:(NSString *)path {
NSURL *url = [NSURL fileURLWithPath:path];
NSError *err = nil;
if ([url checkResourceIsReachableAndReturnError:&err]) {
[[NSWorkspace sharedWorkspace] launchApplication:[url path]];
} else {
NSLog(@"%@", [err localizedDescription]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment