From d735d48d777eb6731a73dde4eb642d27d2da416e Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Mon, 20 Dec 2010 01:33:24 -0500 Subject: [PATCH] Deal with util.getFile breakage with Windows paths. closes issue #193. --- common/modules/util.jsm | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/common/modules/util.jsm b/common/modules/util.jsm index 2f3372f8..97921006 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -577,20 +577,19 @@ const Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]) * @param {nsIURI} uri The URI for which to find a file. */ getFile: function getFile(uri) { - if (isString(uri)) - try { + try { + if (isString(uri)) uri = util.newURI(uri); - } - catch (e) { - return null; - } - if (uri instanceof Ci.nsIFileURL) - return File(uri.QueryInterface(Ci.nsIFileURL).file); - let channel = services.io.newChannelFromURI(uri); - channel.cancel(Cr.NS_BINDING_ABORTED); - if (channel instanceof Ci.nsIFileChannel) - return File(channel.QueryInterface(Ci.nsIFileChannel).file); + if (uri instanceof Ci.nsIFileURL) + return File(uri.QueryInterface(Ci.nsIFileURL).file); + + let channel = services.io.newChannelFromURI(uri); + channel.cancel(Cr.NS_BINDING_ABORTED); + if (channel instanceof Ci.nsIFileChannel) + return File(channel.QueryInterface(Ci.nsIFileChannel).file); + } + catch (e) {} return null; },