(glob string, binary bool)
| 63 | } |
| 64 | |
| 65 | func findBestPath(glob string, binary bool) string { |
| 66 | matches, err := filepath.Glob(glob) |
| 67 | if err != nil { |
| 68 | glog.Warningf("Error globbing %q: %s", glob, err) |
| 69 | return "" |
| 70 | } |
| 71 | if len(matches) == 0 { |
| 72 | return "" |
| 73 | } |
| 74 | // Iterate backwards: newer versions should be sorted to the end. |
| 75 | sort.Strings(matches) |
| 76 | for i := len(matches) - 1; i >= 0; i-- { |
| 77 | path := matches[i] |
| 78 | fi, err := os.Stat(path) |
| 79 | if err != nil { |
| 80 | glog.Warningf("Error statting %q: %s", path, err) |
| 81 | continue |
| 82 | } |
| 83 | if !fi.Mode().IsRegular() { |
| 84 | continue |
| 85 | } |
| 86 | if binary && fi.Mode().Perm()&0111 == 0 { |
| 87 | continue |
| 88 | } |
| 89 | return path |
| 90 | } |
| 91 | return "" |
| 92 | } |
| 93 | |
| 94 | func setDriverPaths() error { |
| 95 | if *selenium3Path == "" { |
no outgoing calls
no test coverage detected
searching dependent graphs…