show symlink destination (#374)

Co-authored-by: wedens <kirill.wedens@gmail.com>
This commit is contained in:
wedensandwedens authored and GitHub committed 2020-06-09 02:38:46 +03:00
1 parent 41e0bb32cd
commit 8933a3eafe
2 files changed
+12 -1

No files matched your search

+7
View File
@@ -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,