tile38/controller/glob.go

19 lines
345 B
Go
Raw Normal View History

2016-03-05 02:08:16 +03:00
package controller
import "path"
func globMatch(pattern, name string) (matched bool, err error) {
return path.Match(pattern, name)
}
func globIsGlob(pattern string) bool {
for i := 0; i < len(pattern); i++ {
switch pattern[i] {
case '[', '*', '?':
_, err := globMatch(pattern, "whatever")
return err == nil
}
}
return false
}