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:
@@ -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;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user