[windows] Do not include directories in the list

Fix #1926
This commit is contained in:
Junegunn Choi
2020-03-14 21:43:35 +09:00
parent 14f90502a4
commit c39113ee41

View File

@@ -156,10 +156,11 @@ func (r *Reader) readFiles() bool {
fn := func(path string, mode os.FileInfo) error { fn := func(path string, mode os.FileInfo) error {
path = filepath.Clean(path) path = filepath.Clean(path)
if path != "." { if path != "." {
if mode.Mode().IsDir() && filepath.Base(path)[0] == '.' { isDir := mode.Mode().IsDir()
if isDir && filepath.Base(path)[0] == '.' {
return filepath.SkipDir return filepath.SkipDir
} }
if r.pusher([]byte(path)) { if !isDir && r.pusher([]byte(path)) {
atomic.StoreInt32(&r.event, int32(EvtReadNew)) atomic.StoreInt32(&r.event, int32(EvtReadNew))
} }
} }