Skip to content

Commit

Permalink
Exclude android from linux matches
Browse files Browse the repository at this point in the history
Fixes #30
  • Loading branch information
zyedidia committed May 29, 2022
1 parent b5261f0 commit 030bdb9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,16 @@ func (dc *DetectorChain) Detect(assets []string) (string, []string, error) {
type OS struct {
name string
regex *regexp.Regexp
anti *regexp.Regexp
priority *regexp.Regexp // matches to priority are better than normal matches
}

// Match returns true if the given archive name is likely to store a binary for
// this OS. Also returns if this is a priority match.
func (os *OS) Match(s string) (bool, bool) {
if os.anti != nil && os.anti.MatchString(s) {
return false, false
}
if os.priority != nil {
return os.regex.MatchString(s), os.priority.MatchString(s)
}
Expand All @@ -61,6 +65,7 @@ var (
OSLinux = OS{
name: "linux",
regex: regexp.MustCompile(`(?i)(linux)`),
anti: regexp.MustCompile(`(?i)(android)`),
priority: regexp.MustCompile(`\.appimage$`),
}
OSNetBSD = OS{
Expand Down

0 comments on commit 030bdb9

Please sign in to comment.