[RFC] Operating system name/version detection

Lubomir I. Ivanov neolit123 at gmail.com
Thu Apr 10 12:59:50 PDT 2014

On 10 April 2014 22:35, Robert C. Helling <helling at atdotde.de> wrote:
> On 10 Apr 2014, at 18:20, Dirk Hohndel <dirk at hohndel.org> wrote:
> Hi,
>> I asked Joshua to send it here so I could test it and everyone could
>> provide input. Robert (or any of the other main Mac based developers),
>> can you make sure this makes sense? Lubomir, what about your native
>> builds on Windows, does this work?
> it semi-works on mac:
>  #ifdef Q_OS_UNIX
> is indeed true. But /etc/os-release does not exist and thus the fstat on it fails and only the osName is correctly set as “Darwin” while the osType is incorrectly set as “Linux” and the version and otherDetails are the empty string.
> Apparently the way to get the OS X version is to run sw_vers which in my case returns
> th-nb-tmpmbp02:subsurface Robert.Helling$ sw_vers
> ProductName:    Mac OS X
> ProductVersion: 10.9.2
> BuildVersion:   13C64
> The three lines can be obtained by themselves with command line switches like -productVersion

looks like sw_vers reads these files:
/System/Library/CoreServices/SystemVersion.plist (if workstation)
/System/Library/CoreServices/ServerVersion.plist (if server)


More information about the subsurface mailing list