Skip to content

Commit

Permalink
Merge pull request #417 from rajkumarGosavi/version-regex-fix
Browse files Browse the repository at this point in the history
Handle missing patch version by making it optional in regex matching.
  • Loading branch information
AXDOOMER authored Oct 10, 2023
2 parents 1b57a64 + 97fe81c commit e5c4d36
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ func serverInfo(paClient *pulseaudio.Client) (audioserverinfo, error) {
} else {
servername = "PulseAudio"
servertype = servertype_pulse
versionRegex = regexp.MustCompile(`.*?(\d+)\.(\d+)\.(\d+).*?`)
versionRegex = regexp.MustCompile(`.*?(\d+)\.(\d+)\.?(\d+)?.*?`)
versionString = info.PackageVersion
log.Printf("Detected PulseAudio\n")
}
Expand All @@ -264,6 +264,11 @@ func serverInfo(paClient *pulseaudio.Client) (audioserverinfo, error) {
log.Printf("couldn't parse server version, regexp didn't match version: %s\n", versionString)
return audioserverinfo{servertype: servertype}, nil
}
// the server version did not match the standard `major.minor.patch` pattern
// setting the patch version to default 0
if res[3] == "" {
res[3] = "0"
}
major, err = strconv.Atoi(res[1])
if err != nil {
return audioserverinfo{servertype: servertype}, err
Expand Down Expand Up @@ -330,7 +335,7 @@ func getDefaultSinkID(client *pulseaudio.Client) (string, error) {
return server.DefaultSink, nil
}

//this is disgusting
// this is disgusting
func fixWindowClass() {
xu, err := xgbutil.NewConn()
defer xu.Conn().Close()
Expand Down

0 comments on commit e5c4d36

Please sign in to comment.