1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-04 15:44:11 +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.
*/
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;
},