clean path before changing directory

This commit is contained in:
Gokcehan 2016-10-02 00:39:03 +03:00
parent 7fe72c188f
commit d66eb7349d
2 changed files with 2 additions and 0 deletions

1
nav.go
View File

@ -326,6 +326,7 @@ func (nav *Nav) top() {
func (nav *Nav) cd(wd string) error {
wd = strings.Replace(wd, "~", envHome, -1)
wd = filepath.Clean(wd)
if !filepath.IsAbs(wd) {
wd = filepath.Join(nav.currDir().path, wd)

1
ui.go
View File

@ -476,6 +476,7 @@ func (ui *UI) draw(nav *Nav) {
dir := nav.currDir()
path := strings.Replace(dir.path, envHome, "~", -1)
path = filepath.Clean(path)
ui.pwdwin.printf(0, 0, termbox.AttrBold|termbox.ColorGreen, bg, "%s@%s", envUser, envHost)
ui.pwdwin.printf(len(envUser)+len(envHost)+1, 0, fg, bg, ":")