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 !
No, it's not possible.
Adobe Acrobat allows you to attach, or bind, an EXE file with a PDF file. However, for security reasons, EXE files cannot, by default, be saved or opened with Acrobat.
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];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With