Question

Assume we have a XULRunner application installed at C:\myapp\, that is, application.ini file etc. are in that directory. My question is: how to get the installation path (C:\myapp\) in the app's JavaScript code?

Was it helpful?

Solution

I think that for XULrunner, CurProcD is usually the installation path:

var path = Components.classes["@mozilla.org/file/directory_service;1"]
             .getService(Components.interfaces.nsIProperties)
             .get("CurProcD", Components.interfaces.nsIFile).path;

Failing that, you might also try resource:app.

Ref: File I/O at MDN.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top