[Jslib] Getting location of extension jarfile in Mozilla and Firefox

Brian King brian at mozdev.org
Fri Oct 8 00:17:22 EDT 2004


On 6.10.2004 23:26, Sudhakar Chandra wrote:

> Hi,
> 
> Is there anything in JSLib that would give me the location of an 
> extension.jar file in both Mozilla and Firefox?
> 
> I know that in Mozilla I can use DirUtils.getUserChromeDir() will give 
> me the location of chrome.  Unfortunately, I can't use this in Firefox 
> because there the jar is stored under extensions/ and not chrome/

Have a look at this file:

http://www.mozdev.org/source/browse/cdn/xul/chromedit/content/chromedit.js

There is a function I wrote, getExtDefaultsPath(), that you could adapt 
for your needs. What you would have to do is:

- pass emid (the extension id) to the function. In this file it is 
defined as a const.
- append 'chrome' instead of 'defaults'. Extension jar files live in 
'chrome' under the extension id dir.
- omit the seamonkey fork if your extension is not aimed there.

Note that is uses general Mozilla API calls, but could easily be 
converted to jslib calls. If you do so, send me the code and I'll 
include it in one of the dir classes or perhaps a new extension manager 
class. It's something I need to do anyway.

-- 
Brian King
www.mozdev.org - free project hosting for the mozilla community


More information about the Jslib mailing list