[RFC] Operating system name/version detection

Robert C. Helling helling at atdotde.de
Thu Apr 10 12:35:29 PDT 2014

On 10 Apr 2014, at 18:20, Dirk Hohndel <dirk at hohndel.org> wrote:


> 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


Robert C. Helling     Elite Master Course Theoretical and Mathematical Physics  
                      Scientific Coordinator                                   
                      Ludwig Maximilians Universitaet Muenchen, Dept. Physik    
print "Just another   Phone: +49 89 2180-4523  Theresienstr. 39, rm. B339       
    stupid .sig\n";   http://www.atdotde.de 

More information about the subsurface mailing list