Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Getting the current profile or extension folder path

37 views
Skip to first unread message

gsta...@gmail.com

unread,
Nov 20, 2006, 8:52:52 AM11/20/06
to
Hello

I am developing an extension that will be using a Java library (see
http://developer.mozilla.org/en/docs/Java_in_Firefox_Extensions). I
need a way to programmatically know the absolute path of the directory
where the extension is deployed (on any platform). A call to
document.location in a XUL file gets the Firefox installation
directory. Is there some other service or method call that will return
the path to the user's profile or even better, the path to my current
extension?

Thank you in advance for your time.

-GS

Benjamin Smedberg

unread,
Nov 20, 2006, 9:48:43 AM11/20/06
to
gsta...@gmail.com wrote:

> directory. Is there some other service or method call that will return
> the path to the user's profile or even better, the path to my current
> extension?

Use the __LOCATION__ trick documented here:

http://developer.mozilla.org/en/docs/Creating_Custom_Firefox_Extensions_with_the_Mozilla_Build_System#Accessing_Data_Files_From_Components

--BDS

gsta...@gmail.com

unread,
Nov 20, 2006, 10:11:09 AM11/20/06
to
Thank you Benjamin. You just saved me some considerable time.

-GS

eric...@yahoo.com

unread,
Nov 20, 2006, 11:30:43 AM11/20/06
to dev-ext...@lists.mozilla.org
You can also do this:
http://developer.mozilla.org/en/docs/Code_snippets:File_I/O#Getting_your_extension.27s_folder

-GS

_______________________________________________
dev-extensions mailing list
dev-ext...@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-extensions


____________________________________________________________________________________
Sponsored Link

Mortgage rates near 39yr lows.
$510k for $1,698/mo. Calculate new payment!
www.LowerMyBills.com/lre

Benjamin Smedberg

unread,
Nov 20, 2006, 11:47:20 AM11/20/06
to

I do not recommend using this method. nsIExtensionManager is a very fluid
interface, and __LOCATION__ is pretty much guaranteed to exist.

--BDS

eric...@yahoo.com

unread,
Nov 20, 2006, 3:18:56 PM11/20/06
to dev-ext...@lists.mozilla.org
I've updated the MDC documentation with your recommendation.

----- Original Message ----
From: Benjamin Smedberg <benj...@smedbergs.us>
To: dev-ext...@lists.mozilla.org
Sent: Monday, November 20, 2006 11:47:20 AM
Subject: Re: Getting the current profile or extension folder path

--BDS

0 new messages