PackageManager just because
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
974 B

package Filesystem
import (
"regexp"
"PackageManager/Variables"
)
var (
PruneRegex []*regexp.Regexp
IgnoreRegex []*regexp.Regexp
)
func init() {
var e error
e = InitPruneRegex()
if e != nil {
panic(e)
}
e = InitIgnoreRegex()
if e != nil {
panic(e)
}
}
func InitPruneRegex() error {
var (
r *regexp.Regexp
s string
e error
)
for _, s = range Variables.PruneRegexPaths {
r, e = regexp.Compile(s)
if e != nil {
return e
}
PruneRegex = append(PruneRegex, r)
}
return nil
}
func InitIgnoreRegex() error {
var (
r *regexp.Regexp
s string
e error
)
for _, s = range Variables.IgnoreRegexPaths {
r, e = regexp.Compile(s)
if e != nil {
return e
}
IgnoreRegex = append(IgnoreRegex, r)
}
return nil
}
func matchAny(p string, a []*regexp.Regexp) bool {
var (
regex *regexp.Regexp
match bool
)
for _, regex = range a {
match = regex.MatchString(p)
if match == true {
return true
}
}
return false
}