I would like to embed a command-line executable in my Xcode/Cocoa project, to then start it with NSTask. Which path should I use in the setLaunchPath ?
Thanks !
I would like to embed a command-line executable in my Xcode/Cocoa project, to then start it with NSTask. Which path should I use in the setLaunchPath ?
Thanks !
you should add it to your resources folder. Then, in runtime, read the app's resource bundle path, and append the name of the executable (including subfolders if you add it to a folder inside the resource bundle)
For instance:
NSString *execPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"binaryname"];
NSTask *task = [[NSTask alloc] init];
[task setLaunchPath: execPath];
© 2022 - 2024 — McMap. All rights reserved.