• 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: How can a plug-in bundle get access to its own resources?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How can a plug-in bundle get access to its own resources?


  • Subject: Re: How can a plug-in bundle get access to its own resources?
  • From: Motti Shneor <email@hidden>
  • Date: Tue, 10 Nov 2009 07:59:04 -0500
  • Acceptlanguage: en-US
  • Thread-topic: How can a plug-in bundle get access to its own resources?

Thanks guys, but you may have not read all my message ---

The [NSBundle bundleForClass:[self class]];

is unusable for me, because I have many plugins that build from the same code, and export the same class (of course --- the same class name).

Obj-C has no name-spaces, and so, If you load 2 such plugins, and use the [NSBundle bundleForClass:[self class]] in each of them independently --- you'll get erroneous answers! both of them will return the same bundle although they come from different bundles.

This is hardly a system "bug" because there are no namespaces, and for the same class name there is only one bundle.

Any other ideas?


On 10/11/2009, at 13:57, Kiel Gillard wrote:

> On 10/11/2009, at 10:51 PM, Benjamin Miller wrote:
>
>> On 10 Nov 2009, at 11:45, Motti Shneor wrote:
>>
>>> This may seem a silly question, but I cannot find any decent way
>>> for my Plug-In bundle code to access its own resources!
>>>
>>> ... snip ...
>>>
>>> Is there a way out? Is there any trick, or technique to work around
>>> this bizarre deficiency of the Bundle mechanism?
>>
>>
>>
>> [[NSBundle bundleForClass] self class] ?
>
> More correctly:
>
> NSBundle *pluginBundle = [NSBundle bundleForClass:[self class]];
> <http://developer.apple.com/mac/library/documentation/cocoa/reference/foundation/Classes/NSBundle_Class/Reference/Reference.html#//apple_ref/occ/clm/NSBundle/bundleForClass:
>>
>
> Then you can access the paths of the resources associated with that
> bundle using the usual methods identified in the reference given above.
>
> Kiel

Motti Shneor
------------------------------------------
Senior Software Engineer
Waves Audio ltd.

Phone: +972-3-6094415
Mobile: +972-54-4470730
[mailto: email@hidden]



_______________________________________________

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

  • Follow-Ups:
    • Re: How can a plug-in bundle get access to its own resources?
      • From: Douglas Davidson <email@hidden>
    • Re: How can a plug-in bundle get access to its own resources?
      • From: Alastair Houghton <email@hidden>
    • Re: How can a plug-in bundle get access to its own resources?
      • From: Mike Abdullah <email@hidden>
References: 
 >How can a plug-in bundle get access to its own resources? (From: Motti Shneor <email@hidden>)
 >Re: How can a plug-in bundle get access to its own resources? (From: Benjamin Miller <email@hidden>)
 >Re: How can a plug-in bundle get access to its own resources? (From: Kiel Gillard <email@hidden>)

  • Prev by Date: cocoabuilder.com
  • Next by Date: Re: How can a plug-in bundle get access to its own resources?
  • Previous by thread: Re: How can a plug-in bundle get access to its own resources?
  • Next by thread: Re: How can a plug-in bundle get access to its own resources?
  • Index(es):
    • Date
    • Thread