janekw wrote:
Can you obtain the
absolute path to, for instance, the working folder?
Yeah:
var file = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties)
.get("CurWorkD", Components.interfaces.nsIFile);
But I'm not sure that you really want this to be relative to the working
directory... You can get your application directory (as opposed to the
xulrunner directory) too, at least in newer versions, but I don't know how.
(I'm assuming you want this from JS, in C++ this'd of course look
differently)
Or to the local html file you're currently displaying?
Yes, but to answer how I'd need to know what you have...
If you have an nsIURI, you can QueryInterface it to an nsIFileURI which
has a file property.
If you have an nsIWebNavigation, you can get an nsIURI from that. If you
have a <browser>, it has a currentURI property. You can then apply what
I said in the previous paragraph :)
_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom