Launching a Carbon program with NSTask?
Launching a Carbon program with NSTask?
- Subject: Launching a Carbon program with NSTask?
- From: Dan Saul <email@hidden>
- Date: Sun, 18 Apr 2004 23:09:57 -0500
If written all the code I need to get this to launch Image Capture, but
it won't work with the game that is not cocoa but carbon and not in a
package.
#import "HITPLauncherController.h"
@implementation HITPLauncherController
- (void)awakeFromNib
{
[mainWindow center];
NSArray *pathArray = [NSArray arrayWithObjects:@"System",@"Library",
nil];
NSString *arrString = [pathArray componentsJoinedByString:@"/"];
NSLog(arrString);
NSFileManager *manager = [NSFileManager defaultManager];
NSString * appBundlePath = [[NSBundle bundleForClass:[self class]]
bundlePath];
appBundlePath = [appBundlePath stringByDeletingLastPathComponent];
NSLog(appBundlePath);
NSArray * directorylistArray = [manager
directoryContentsAtPath:appBundlePath];
NSString * directorylistString = [directorylistArray
componentsJoinedByString:@", "];
NSLog(directorylistString);
/* Move files to main */
NSLog(@"Move files to main");
/* Start Moh */
timer = [[NSTimer scheduledTimerWithTimeInterval:2 target:self
selector:@selector(runAndQuitMohaa) userInfo:nil repeats:NO] retain];
}
- (void)runAndQuitMohaa
{
NSLog(@"RunMoH");
NSTask *banner;
NSPipe *thePipe=[[NSPipe alloc] init];
NSPipe *output=[[NSPipe alloc] init];
banner=[[NSTask alloc] init];
//[banner setLaunchPath:@"/Applications/Image
Capture.app/Contents/MacOS/Image Capture"];//test
[banner setLaunchPath:@"/Applications/Games/Medal of Honor/mohaa"];
[banner setStandardOutput:output];
[banner launch];
[banner waitUntilExit];
/* Move files back to mainhitp */
[self cleanUp];
/* Quit */
NSLog(@"Quit");
[NSApp terminate:nil];
/* Release Variables */
[output release];
[thePipe release];
[banner release];
}
- (void)cleanUp
{
NSLog(@"Move files back to mainhitp");
}
@end
I have no idea how to fix this to it will run it this is a carbon cfm
application.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.