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)

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.


you could also use
http://lxr.mozilla.org/seamonkey/source/netwerk/protocol/file/public/nsIFileProtocolHandler.idl#64
but then you have to get the file protocol handler first.

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

Reply via email to