1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 10:18:00 +01:00

output an error message on :cd - if there is no alternate directory

This commit is contained in:
Doug Kearns
2008-08-30 03:12:14 +00:00
parent 0a10028910
commit a0ab368082

View File

@@ -78,7 +78,21 @@ liberator.IO = function () //{{{
function (args) function (args)
{ {
if (!args) if (!args)
{
args = "~"; args = "~";
}
else if (args == "-")
{
if (oldcwd)
{
args = oldcwd;
}
else
{
liberator.echoerr("E186: No previous directory");
return;
}
}
if (liberator.io.setCurrentDirectory(args)) if (liberator.io.setCurrentDirectory(args))
liberator.echo(liberator.io.getCurrentDirectory()); liberator.echo(liberator.io.getCurrentDirectory());
@@ -297,7 +311,7 @@ liberator.IO = function () //{{{
if (newdir == "-") if (newdir == "-")
{ {
[cwd, oldcwd] = [oldcwd, cwd]; [cwd, oldcwd] = [oldcwd, this.getCurrentDirectory()];
} }
else else
{ {
@@ -308,7 +322,7 @@ liberator.IO = function () //{{{
liberator.echoerr("E344: Can't find directory \"" + newdir + "\" in path"); liberator.echoerr("E344: Can't find directory \"" + newdir + "\" in path");
return null; return null;
} }
[cwd, oldcwd] = [newdir, cwd]; [cwd, oldcwd] = [newdir, this.getCurrentDirectory()];
} }
return ioManager.getCurrentDirectory(); return ioManager.getCurrentDirectory();
}, },