diff --git a/nav.go b/nav.go index f983f78..f5abf81 100644 --- a/nav.go +++ b/nav.go @@ -28,6 +28,7 @@ const ( type file struct { os.FileInfo linkState linkState + linkTarget string path string dirCount int accessTime time.Time @@ -56,6 +57,7 @@ func readdir(path string) ([]*file, error) { } var linkState linkState + var linkTarget string if lstat.Mode()&os.ModeSymlink != 0 { stat, err := os.Stat(fpath) @@ -65,6 +67,10 @@ func readdir(path string) ([]*file, error) { } else { linkState = broken } + linkTarget, err = os.Readlink(fpath) + if err != nil { + return files, err + } } ts := times.Get(lstat) @@ -85,6 +91,7 @@ func readdir(path string) ([]*file, error) { files = append(files, &file{ FileInfo: lstat, linkState: linkState, + linkTarget: linkTarget, path: fpath, dirCount: -1, accessTime: at, diff --git a/ui.go b/ui.go index 2cb7f11..2f43633 100644 --- a/ui.go +++ b/ui.go @@ -559,7 +559,11 @@ func (ui *ui) loadFileInfo(nav *nav) { return } - ui.echof("%v %4s %v", curr.Mode(), humanize(curr.Size()), curr.ModTime().Format(gOpts.timefmt)) + var linkTarget string + if curr.linkTarget != "" { + linkTarget = " -> " + curr.linkTarget + } + ui.echof("%v %4s %v%s", curr.Mode(), humanize(curr.Size()), curr.ModTime().Format(gOpts.timefmt), linkTarget) } func (ui *ui) drawPromptLine(nav *nav) {