Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Tank2005

macrumors newbie
Original poster
Apr 24, 2009
4
0
I developing Photoshop Plug-in(xcode bundle project).
I want to get the path of own bundle program.
My ideal is that returns such as "MyPlugin.plugin". But, follow code returns "Photoshop.app".
NSString *mpath = [[NSBundle mainBundle]bundlePath];

Please teach me.
 
The main bundle is always the bundle of the actual executing app. As plugins execute within the app process this will not get you what you want.

NSBundle provides the bundleForClass: method. If you pass this the class object for a class in your bundle then you will get what you want.

If we assume the main class in your plugin is called MyPluginClass then this would work:

Code:
NSString *mpath = [[NSBundle bundleForClass:[MyPluginClass  class]] bundlePath];

(note code tags make everyones life better: use them)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.