mirror of
https://github.com/rclone/rclone.git
synced 2024-12-22 15:11:56 +01:00
version: fix reported os/kernel version for windows
This commit is contained in:
parent
52fbb10b47
commit
bdfe213c47
@ -1,7 +1,6 @@
|
||||
package buildinfo
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
"unsafe"
|
||||
@ -32,10 +31,10 @@ func GetOSVersion() (osVersion, osKernel string) {
|
||||
}
|
||||
}
|
||||
|
||||
// Simplify kernel output: `RELEASE.BUILD Build BUILD` -> `RELEASE.BUILD`
|
||||
match := regexp.MustCompile(`^([\d\.]+?\.)(\d+) Build (\d+)$`).FindStringSubmatch(osKernel)
|
||||
// Simplify kernel output: `MAJOR.MINOR.BUILD.REVISION Build BUILD.REVISION` -> `MAJOR.MINOR.BUILD.REVISION`
|
||||
match := regexp.MustCompile(`^(\d+\.\d+\.(\d+\.\d+)) Build (\d+\.\d+)$`).FindStringSubmatch(osKernel)
|
||||
if len(match) == 4 && match[2] == match[3] {
|
||||
osKernel = match[1] + match[2]
|
||||
osKernel = match[1]
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,11 +52,6 @@ func GetOSVersion() (osVersion, osKernel string) {
|
||||
}
|
||||
}
|
||||
|
||||
updateRevision := getRegistryVersionInt("UBR")
|
||||
if osKernel != "" && updateRevision != 0 {
|
||||
osKernel += fmt.Sprintf(".%d", updateRevision)
|
||||
}
|
||||
|
||||
if arch, err := host.KernelArch(); err == nil && arch != "" {
|
||||
if strings.HasSuffix(arch, "64") && osVersion != "" {
|
||||
osVersion += " (64 bit)"
|
||||
|
Loading…
Reference in New Issue
Block a user