[RFC] Operating system name/version detection

Lubomir I. Ivanov neolit123 at gmail.com
Thu Apr 10 10:57:02 PDT 2014


On 10 April 2014 19:20, Dirk Hohndel <dirk at hohndel.org> wrote:
>
> Thiago,
>
> I believe this is largely borrowed from your code - can you work with
> Joshua on good / correct attribution of the code origin. Also, would you
> do a quick review of the code?
>
> 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?
>
> Thanks everyone for your help

joshua,
here are some errors that i get on windows.

errors:
----------

1)
QSysInfo::WV_NT should be used instead of WV_NT and similar.

----------

2)
there is a typo near:
-       case WV_WINDOWS8:
-               ros_details.versionString = "8";
^ 'ros  instead of 'os'

----------

3)
'WV_WINDOWS8_1' is not part of Qt 4.8.

i think it should be wrapped in:
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
...
#endif

----------

4)
all the switch() cases 'under #ifdef Q_OS_WIN' need 'break;' or it will fall to:
os_details.versionString = "CE6";

----------
non-errors / ideas:

1)

i don't think these are needed, as i don't see actual debug code or
error handling:

#if !defined(Q_OS_WINCE)
#include <errno.h>
#if defined(Q_CC_MSVC)
#include <crtdbg.h>
#endif

also we don't really support MSVC.

----------

2)

i'm pretty sure that #ifdef Q_OS_UNIX will branch OSX as well, so
perhaps Q_OS_MAC / Q_OS_LINUX have to be used.
also a quick google search for similar code shows people not using
"/etc/os-release" for OSX detection in favour of a shell script:
"sw_vers -productVersion"

----------

i've tried building on linux but i get some linker errors with:
 libgit2-0                              0.18.0
will have to find why is that.

lubomir
--


More information about the subsurface mailing list