Christian Biesinger wrote:
On Fri, Jul 16, 2004 at 03:01:34PM +1000, Nick Kaltner wrote:

var obj_URI = Components.classes["@mozilla.org/network/standard-url;1"].createInstance(Components.interfaces.nsIURL);


urg, why do people keep doing that? this code is WRONG. (except if you
are implementing a protocol handler)

ahh of course. as for why people still do that, it's probably a combination of the fact that it works, and that noone tells them otherwise :)


I don't know what i was thinking, actually.


To convert from a file uri to an nsIFile: var ios = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);

 var uri = ios.newURI("file:///...", "", null); // <-- this is how you
                                                // create nsIURI instances!

 var file = uri.QueryInterface(Components.interfaces.nsIFileURL).file;

 // now file is an nsIFile object.


Thanks.

Nick
_______________________________________________
Mozilla-xpcom mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to