1

I have developed a firebreath Npapi plugin for mac osx.My requirement is simple, i want to access the path of this plugin during runtime. i.e., when one of the browser loads it,I want to save the path of plugin and access it later for copying some files and stuffs,how do i do it or is there a method where in, I can set an environmental variable that is accessible only by this plugin? Any kind of suggestions will be helpful.

Vijith
  • 163
  • 2
  • 11

1 Answers1

3

There is two ways to get the plugin path:

  • from Objective C/C++ get the bundles path (not the main bundles, your plugin bundle gets loaded into a container application)
  • from C/C++ you can use dladdr to get the modules path, see e.g. FireBreaths source

When using FireBreath, just use e.g. PluginCore::getFSPath().

Georg Fritzsche
  • 97,545
  • 26
  • 194
  • 236
  • 1
    is there a way i can set an environmental variable which is accessible only to this plugin?? – Vijith Apr 04 '14 at 13:20
  • 2
    Why do you want to set an environmental variable? I don't know what you actually want to do, but it's likely that this is not the best option. – Georg Fritzsche Apr 04 '14 at 15:41
  • 1
    Can i get to know the path of the html file which loads the plugin during runtime?environmental variable is a bad idea i get it..i want to place some assets along with the html file. – Vijith Apr 07 '14 at 11:45
  • 1
    Sure, you are probably looking [`DOMWindow::getLocation()`](http://www.firebreath.org/display/documentation/Tips+and+Tricks#TipsandTricks-GettingtheURLofthecurrentpage). – Georg Fritzsche Apr 08 '14 at 16:09