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