mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-24 21:57:36 +00:00
parent
0acace1ace
commit
9dc3ed638a
@ -4,6 +4,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"io"
|
"io"
|
||||||
|
"io/fs"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -222,6 +223,16 @@ func (r *Reader) readFromStdin() bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isSymlinkToDir(path string, de os.DirEntry) bool {
|
||||||
|
if de.Type()&fs.ModeSymlink == 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if s, err := os.Stat(path); err == nil {
|
||||||
|
return s.IsDir()
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func (r *Reader) readFiles(root string, opts walkerOpts, ignores []string) bool {
|
func (r *Reader) readFiles(root string, opts walkerOpts, ignores []string) bool {
|
||||||
r.killed = false
|
r.killed = false
|
||||||
conf := fastwalk.Config{Follow: opts.follow}
|
conf := fastwalk.Config{Follow: opts.follow}
|
||||||
@ -232,7 +243,7 @@ func (r *Reader) readFiles(root string, opts walkerOpts, ignores []string) bool
|
|||||||
path = filepath.Clean(path)
|
path = filepath.Clean(path)
|
||||||
if path != "." {
|
if path != "." {
|
||||||
isDir := de.IsDir()
|
isDir := de.IsDir()
|
||||||
if isDir {
|
if isDir || opts.follow && isSymlinkToDir(path, de) {
|
||||||
base := filepath.Base(path)
|
base := filepath.Base(path)
|
||||||
if !opts.hidden && base[0] == '.' {
|
if !opts.hidden && base[0] == '.' {
|
||||||
return filepath.SkipDir
|
return filepath.SkipDir
|
||||||
|
Loading…
Reference in New Issue
Block a user