getting current location of an XPCOM component

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

getting current location of an XPCOM component

tarun sharma-3
Hi All,
I have created a extension of my application in ff.
I have created a XPCOM component for that. Everything working fine i.e my application button appears on the toolbar and it runs my exe also,but the problem is i have to give the full local path of my exe in the javascript.
This javascript is in the same folder where user has installed the application.
Now is their any way to get the path of this directory???
I used many things,all of them are giving me my ff installation directories not the directory in which this script is.
Can anyone help please??
 
Tarun Sharma.




 


     
_______________________________________________
dev-accessibility mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-accessibility
Reply | Threaded
Open this post in threaded view
|

Re: getting current location of an XPCOM component

Steve Lee-3
Hi Tarun, this is list is for discussing accessibility issues so you
will have better luck asking such questions on a more general
XUL/externsion list.

However as I have recently dealt with this I'll answer you. it's not
clear which directory you want as you mention exes, XPCOM components,
extensions and scripts. It will be up to you to know where any exe is
installed but if you want to know where your extension is you can use:

const _EXTID = '[hidden email]';  //same as id in install.rdf

function getExtensionRootLocation(id)
{
    id = id || _EXTID;
    var cls = Components.classes["@mozilla.org/extensions/manager;1"];
    var service = cls.getService(Components.interfaces.nsIExtensionManager);
    return service.getInstallLocation(id).getItemLocation(id);
}

const strPath = getExtensionRootPath(id).path;

Steve

2008/10/7 tarun sharma <[hidden email]>:

> Hi All,
> I have created a extension of my application in ff.
> I have created a XPCOM component for that. Everything working fine i.e my application button appears on the toolbar and it runs my exe also,but the problem is i have to give the full local path of my exe in the javascript.
> This javascript is in the same folder where user has installed the application.
> Now is their any way to get the path of this directory???
> I used many things,all of them are giving me my ff installation directories not the directory in which this script is.
> Can anyone help please??
>
> Tarun Sharma.
>
>
>
>
>
>
>
>
> _______________________________________________
> dev-accessibility mailing list
> [hidden email]
> https://lists.mozilla.org/listinfo/dev-accessibility
>



--
Steve Lee
Open Source Assistive Technology Software and Accessibility
fullmeasure.co.uk
_______________________________________________
dev-accessibility mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-accessibility