Re: Execute a pre-starting script first, when the App bundle is launched, then the main executable
Re: Execute a pre-starting script first, when the App bundle is launched, then the main executable
- Subject: Re: Execute a pre-starting script first, when the App bundle is launched, then the main executable
- From: Kyle Sluder <email@hidden>
- Date: Thu, 6 Jan 2011 10:50:50 -0800
On Thu, Jan 6, 2011 at 9:27 AM, eveningnick eveningnick
<email@hidden> wrote:
>> You can't do this. The Info.plist needs to refer to the main app's
>> binary. Instead, put your checks into the main app's startup code.
>> -[<NSApplicationDelegate> applicationDidFinishLaunching:] would be a
>> good place.
>>
>> This will require changes to the main app.
>
> What if i rename the Main Application's executable from
> /Applications/MainApp.app/Contents/MacOS/MainApp
> to
> /Applications/MainApp.app/Contents/MacOS/MainApp1
>
> and rename my pre-startup script to MainApp (and place it in
> /Applications/MainApp.app/Contents/MacOS/MainApp)?
No, because the bundle's binary will still be different from the main app.
> The problem may occur if this is LaunchServices who is responsible for
> delivering info (like main nib filename, or principal class name) from
> the plist to the application, but as far as i know this information is
> retrieved by the application itself, which means that if my script
> launches this renamed Main Application's binary
> (/Applications/MainApp.app/Contents/MacOS/MainApp1) the main
> application should act as usual - read its plist, etc.
No, NSBundle and/or dyld will probably throw a conniption.
Please don't abuse the system like this. If you really wanted, you
could make your "main" app a helper, but then you lose all sorts of
functionality like drag-to-dock-icon.
What's so hard about doing it the right way?
--Kyle Sluder
_______________________________________________
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