Search code examples
macosnpapifirebreathbrowser-plugin

Is there a way to get the npapi plugin path during runtime in mac osx?


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.


Solution

  • 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().