> On Mar 1, 2016, at 12:01 AM, Motti Shneor <[email protected]> wrote:
> 
> 1. Can launchd launch a code bundle? as a daemon?

Launchd has no notion of bundles; those are a concept defined at higher levels. 
Launchd just knows about executable files.

Also, are you sure you want a daemon and not an agent? Daemons run outside of 
any user session, so they can’t access any per-user resources (like defaults) 
or interact with the GUI at all.

(I assume you’ve read the essential TN2083: 
https://developer.apple.com/library/mac/technotes/tn2083/_index.html )

> 3. If I make a code bundle (Plugin style) and tell launchd the exact path of 
> the binary within it - will my binary (started by launchd) still know it is 
> “coming from a bundle”, and will it be able to access its bundle, its 
> resources, its user-defaults in the bundle’s domain, and its internal 
> frameworks?

Bundle/resources — Not automatically, but you should be able to get the path to 
the executable from argv[0], and from there derive the bundle path (probably 
its grandparent), and then instantiate an NSBundle from that. From there you 
can use the NSBundle APIs to load resources.

User defaults — I think you’d have to explicitly load the NSUserDefaults for 
your bundle’s domain.

Frameworks — It should have access to those because the relative framework 
paths are recorded in the executable itself.

—Jens
_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to