add executable completion on windows

This commit is contained in:
Gokcehan committed 2018-06-29 00:12:54 +03:00
1 parent fef99c1d70
commit e1b6d38386
3 files changed
+22 -2

No files matched your search

+3 -2
View File
@@ -134,7 +134,7 @@ func matchWord(s string, words []string) (matches []string, longest string) {
func matchExec(s string) (matches []string, longest string) {
var words []string
paths := strings.Split(envPath, ":")
paths := strings.Split(envPath, string(filepath.ListSeparator))
for _, p := range paths {
if _, err := os.Stat(p); os.IsNotExist(err) {
@@ -157,10 +157,11 @@ func matchExec(s string) (matches []string, longest string) {
continue
}
if !f.Mode().IsRegular() || f.Mode()&0111 == 0 {
if !f.Mode().IsRegular() || !isExecutable(f) {
continue
}
log.Print(f.Name())
words = append(words, f.Name())
}
}