mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 14:02:28 +01:00
fixed getCurrentDirectory() to not call an infinite loop, makes :cd etc. work on windows hopefully
This commit is contained in:
@@ -95,14 +95,27 @@ vimperator.IO = function () //{{{
|
|||||||
|
|
||||||
getCurrentDirectory: function ()
|
getCurrentDirectory: function ()
|
||||||
{
|
{
|
||||||
|
var file = Components.classes["@mozilla.org/file/local;1"].
|
||||||
|
createInstance(Components.interfaces.nsILocalFile);
|
||||||
|
|
||||||
var dirs = [cwd, "$PWD", "~"];
|
var dirs = [cwd, "$PWD", "~"];
|
||||||
for (var i = 0; i < dirs.length; i++)
|
for (var i = 0; i < dirs.length; i++)
|
||||||
{
|
{
|
||||||
if (!dirs[i])
|
if (!dirs[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (this.getFile(dirs[i]).exists())
|
var fullname = this.expandPath(dirs[i]);
|
||||||
return this.expandPath(dirs[i]);
|
try
|
||||||
|
{
|
||||||
|
file.initWithPath(fullname);
|
||||||
|
}
|
||||||
|
catch (e)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file.exists() && file.isDirectory())
|
||||||
|
return fullname;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user