I can run an executable from a known local directory within a Cocoa app like this:
// Run the server.
NSTask *task = [[NSTask alloc] init];
NSPipe *pipe = [NSPipe pipe];
NSString* scriptPath = @"/Users/example/Server/runServerExecutable.sh";
[task setLaunchPath: @"/bin/sh"];
[task setArguments: [NSArray arrayWithObjects: scriptPath, nil]];
[task setStandardOutput: pipe];
[task launch];
Could anyone help me on these questions?
- Where should I include the executable/script/text files in the app bundle?
- How to modify
scriptPath
to run the script programmatically?
Thanks a lot!