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

floyde

macrumors 6502a
Original poster
Apr 7, 2005
808
1
Monterrey, México
I seem to have encountered my first Mac programming pitfall...

I'm writing a Webkit plugin for Safari which at some point loads and executes an Applescript file. I added the script file to my project's resource folder in hopes that I would be able to find it later using the NSBundle class. The problem I have, is that when I try to find the plugin's resource path (in order to load the script), such as:

Code:
NSString *scriptPath = [[NSBundle mainBundle] resourcePath];
I get Safari.app's resource path, not the plugin's resource path (which is the one I need). I've been able to load the script with an absolute path, but this approach has a few problems. The plugin can be installed in the users Library folder as well as the system's library folder (so I'd have to check both folders). Also, if the installation path for Safari plugins were to change, my plugin wouldn't work anymore... So how can I dynamically obtain the path of my plugin's Resource folder? thanks
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.