Snippet #57
Language: Objective-C, Author: Michele Balistreri
License: Public domain
This is a sample trampoline application, aiming to simply installation&update of command line tools by Cocoa application. Take a look at http://briksoftware.com/blog/?p=70 for more informations.
int main(int argc, char *argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSWorkspace *env = [NSWorkspace sharedWorkspace]; NSString *app = [env absolutePathForAppBundleWithIdentifier:@"YOURBUNDLEIDHERE"]; NSString *targetPath = [[app stringByAppendingPathComponent:@"Contents/Resources/EXECUTABLENAME"] retain]; const char *CStringPath = [targetPath UTF8String]; [pool release]; execv(CStringPath, argv); // You reach this code only if execv returns, if execv returns it means that something wrong happened. [targetPath release]; printf("YOURERRORMESSAGE"); return 0; }
Compatible with:
- Mac OS X 10.3
- Mac OS X 10.4 PPC
- Mac OS X 10.4 Intel
- Mac OS X 10.5 PPC
- Mac OS X 10.5 Intel
Comments
Comment feed
