• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Can launchd start a daemon from a code-bundle? Can I bundle my daemon?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can launchd start a daemon from a code-bundle? Can I bundle my daemon?


  • Subject: Re: Can launchd start a daemon from a code-bundle? Can I bundle my daemon?
  • From: Jens Alfke <email@hidden>
  • Date: Tue, 01 Mar 2016 10:19:00 -0800

> On Mar 1, 2016, at 12:01 AM, Motti Shneor <email@hidden> 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@hidden)

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:

This email sent to email@hidden


References: 
 >Can launchd start a daemon from a code-bundle? Can I bundle my daemon? (From: Motti Shneor <email@hidden>)

  • Prev by Date: Re: Starting out with storyboards (on Mac)
  • Next by Date: Re: Starting out with storyboards (on Mac)
  • Previous by thread: Can launchd start a daemon from a code-bundle? Can I bundle my daemon?
  • Next by thread: Starting out with storyboards (on Mac)
  • Index(es):
    • Date
    • Thread