Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Commit

Permalink
fix windows full path scan fixes #790
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Dec 15, 2017
1 parent c5e8a83 commit 0ab07f0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion plugins/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func Available() (List, error) {
paths = append(paths, strings.Split(os.Getenv("PATH"), ":")...)
}
for _, p := range paths {
if strings.HasPrefix(strings.ToLower(p), `c:\windows`) {
if ignorePath(p) {
continue
}
if _, err := os.Stat(p); err != nil {
Expand Down Expand Up @@ -93,3 +93,13 @@ func askBin(path string) Commands {
}
return commands
}

func ignorePath(p string) bool {
p = strings.ToLower(p)
for _, x := range []string{`c:\windows`, `c:\program`} {
if strings.HasPrefix(p, x) {
return true
}
}
return false
}

0 comments on commit 0ab07f0

Please sign in to comment.