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

Getting current directory for xulrunner applications

174 views
Skip to first unread message

fire...@bigpond.net.au

unread,
Oct 10, 2006, 10:13:00 AM10/10/06
to
G'day all.

Im just wondering is there a way of getting the current directory a
script resides in?

Say my xulrunner powered application was installed by the end user in
e:\apps\myapp, how could I check what directory the application.ini
file was in using javascript?

Cheers,
Heath

Igor Tandetnik

unread,
Oct 10, 2006, 10:58:04 AM10/10/06
to

Use directory service:

http://developer.mozilla.org/en/docs/nsDirectoryService

The key to the folder where application.ini resides is "resource:app"

Igor Tandetnik


Casperion

unread,
Oct 10, 2006, 6:42:49 PM10/10/06
to
I tried using:

Components.classes['@mozilla.org/file/directory_service;1'].getService(Components.interfaces.nsIProperties).get("resource:app",Components.interfaces.nsIFile).path

but it came up with:

Error: uncaught exception: [Exception... "Component returned failure
code: 0x80004005 (NS_ERROR_FAILURE) [nsIProperties.get]" nsresult:
"0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: javascript:
Components.classes['@mozilla.org/file/directory_service;1'].getService(Components.interfaces.nsIProperties).get("resource:app",Components.interfaces.nsIFile).path
:: <TOP_LEVEL> :: line 1" data: no]

Any ideas?

Cheers,
Heath

Igor Tandetnik

unread,
Oct 24, 2006, 3:53:44 PM10/24/06
to
Works for me. Is this line in a script file running from inside locally
installed chrome?

Igor Tandetnik

0 new messages