Update host_darwin.go

The /System/Library/CoreServices/ServerVersion.plist exists on macOS servers , but not on a workstation such as my laptop. The actual terminoly is mostly borrowed from the windows equivalent as @Lomanic suggested. In theory, this should make interpreting the results from the two platforms a bit more consistent.

Note: The macOS server application can be installed on almost any macOS workstation to make it a server that can manage other apple devices.
This commit is contained in:
Kent 'picat' Gruber 2019-05-31 13:13:06 -04:00
parent 3af6e1ffe7
commit d13ba02ef0
1 changed files with 10 additions and 0 deletions

View File

@ -189,6 +189,16 @@ func PlatformInformationWithContext(ctx context.Context) (string, string, string
pver = strings.ToLower(strings.TrimSpace(string(out)))
}
// check if the macos server version file exists
_, err := os.Stat("/System/Library/CoreServices/ServerVersion.plist")
// server file doesn't exist
if os.IsNotExist(err) {
family = "Standalone Workstation"
} else {
family = "Server"
}
return platform, family, pver, nil
}