OK. I’ll have to answer my own question.  Please forgive me answer is neither 
definitive nor complete, and is ugly - but it works.

Generally: 

1. In a Document based application - the [[[NSDocumentController 
sharedController] documents] firstObject] will give you also access to the file.

2. In a non-document based application - If you have the NSWindow of the open 
document, you can use [NSWindow representedURL] to get to the file.

However: 

3. Alas - my Installer plugin bundle,throughout its lifecycle, has all its 
NSView’s window property set to nil. Also, within the Installer App,  
[NSDocumentController sharedController] documents] is always empty too.

My final workaround was to use  [[NSApp mainWindow] representedURL] when my 
installer plugin was called with- 
(void)willEnterPane:(InstallerSectionDirection)dir  which is called from the 
main-window as the user clicks a “next” button on the installer previous 
stages. It works - although very ugly hack.

Hope it will help someone out...

> On 30 Mar 2016, at 20:11, Jens Alfke <j...@mooseyard.com> wrote:
> 
> 
>> On Mar 30, 2016, at 1:47 AM, Motti Shneor <su...@bezeqint.net 
>> <mailto:su...@bezeqint.net>> wrote:
>> 
>> But still, If a package file was double-clicked to launch the Installer App, 
>> and it received an “Open File” event, is there a way to get to the file 
>> later on, without actually catching this event?
> 
> No, not as far as I know. It’s an ‘odoc’ AppleEvent sent to the app at launch 
> time, and handled by NSApplication, and that info isn’t kept around for later 
> because there isn’t generally any need for it.
> 
> I think you’ve got an Installer-specific issue after all.
> 
> —Jens

Motti Shneor
e-mail: motti.shn...@gmail.com
phone: +972-8-9267730
mobile: +972-54-3136621
---

Ceterum censeo Microsoftinem delendam esse


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to