Reputation: 8699
Can I have the binary files like .sh as part of the .app in "Package Contents".
I basically have .app which has 2 buttons start/stop which basically kicks off a process to start the server. To keep everything clean, I would like to store the start/stop shell scripts within the .app.
Can I execute those shell scripts from .app?
Upvotes: 1
Views: 428
Reputation: 1155
Yes. You'll want to look at NSTask to run your scripts or other binaries, and find the files using NSBundle's API.
Upvotes: 1
Reputation: 57139
On the Mac, yes: use the NSTask class’s +launchedTaskWithLaunchPath:arguments:
method (for example), after retrieving the path to the binaries with one of the methods on NSBundle’s—-resourcePath
, -bundlePath
, -pathForResource:ofType:
, or whatever.
On iOS... no. NSTask isn’t available.
Upvotes: 1