Ticket #3355: mc-wrapper: don't cd to the same directory.

This would make a subsequent "cd -" more convenient. If you don't alter
the directory in mc, after exiting a "cd -" does nothing, whereas it
could take you to the actual previous directory.

Thanks Egmont Koblinger <egmont@gmail.com> for the initial patch.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2020-01-19 15:29:44 +03:00
parent f25135b74b
commit f57daa1678
2 changed files with 2 additions and 2 deletions

View File

@ -10,7 +10,7 @@ endif
if (-r "$MC_PWD_FILE") then
setenv MC_PWD "`cat '$MC_PWD_FILE'`"
if ( -d "$MC_PWD" ) then
if ("$MC_PWD" != "$cwd" && -d "$MC_PWD") then
cd "$MC_PWD"
endif
unsetenv MC_PWD

View File

@ -4,7 +4,7 @@ MC_PWD_FILE="${TMPDIR-/tmp}/mc-$MC_USER/mc.pwd.$$"
if test -r "$MC_PWD_FILE"; then
MC_PWD="`cat "$MC_PWD_FILE"`"
if test -n "$MC_PWD" && test -d "$MC_PWD"; then
if test -n "$MC_PWD" && test "$MC_PWD" != "$PWD" && test -d "$MC_PWD"; then
cd "$MC_PWD"
fi
unset MC_PWD