better (more precise) values for wxGetOsDescription() (patch 1047539)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30432 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -92,11 +92,24 @@ wxToolkitInfo& wxConsoleAppTraits::GetToolkitInfo()
|
||||
{
|
||||
static wxToolkitInfo info;
|
||||
int major, minor;
|
||||
char name[256];
|
||||
|
||||
if ( sscanf(WXWIN_OS_DESCRIPTION, "%255s %d.%d", name, &major, &minor) != 3 )
|
||||
FILE *f = popen("uname -r", "r");
|
||||
if (f)
|
||||
{
|
||||
// unreckognized uname string format
|
||||
char buf[32];
|
||||
size_t c = fread(buf, 1, sizeof(buf) - 1, f);
|
||||
pclose(f);
|
||||
buf[c] = '\0';
|
||||
if ( sscanf(buf, "%d.%d", &major, &minor) != 2 )
|
||||
{
|
||||
// unrecognized uname string format
|
||||
major =
|
||||
minor = -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// failed to run uname
|
||||
major =
|
||||
minor = -1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user