1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-08 05:54:12 +01:00

Deal with util.getFile breakage with Windows paths. closes issue #193.

This commit is contained in:
Kris Maglione
2010-12-20 01:33:24 -05:00
parent b6c8d763fa
commit d735d48d77

View File

@@ -577,20 +577,19 @@ const Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
* @param {nsIURI} uri The URI for which to find a file. * @param {nsIURI} uri The URI for which to find a file.
*/ */
getFile: function getFile(uri) { getFile: function getFile(uri) {
if (isString(uri)) try {
try { if (isString(uri))
uri = util.newURI(uri); uri = util.newURI(uri);
}
catch (e) {
return null;
}
if (uri instanceof Ci.nsIFileURL) if (uri instanceof Ci.nsIFileURL)
return File(uri.QueryInterface(Ci.nsIFileURL).file); return File(uri.QueryInterface(Ci.nsIFileURL).file);
let channel = services.io.newChannelFromURI(uri);
channel.cancel(Cr.NS_BINDING_ABORTED); let channel = services.io.newChannelFromURI(uri);
if (channel instanceof Ci.nsIFileChannel) channel.cancel(Cr.NS_BINDING_ABORTED);
return File(channel.QueryInterface(Ci.nsIFileChannel).file); if (channel instanceof Ci.nsIFileChannel)
return File(channel.QueryInterface(Ci.nsIFileChannel).file);
}
catch (e) {}
return null; return null;
}, },