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:
@@ -837,11 +837,20 @@ bool wxGetUserName(wxChar *buf, int sz)
|
||||
|
||||
wxString wxGetOsDescription()
|
||||
{
|
||||
#ifndef WXWIN_OS_DESCRIPTION
|
||||
#error WXWIN_OS_DESCRIPTION should be defined in config.h by configure
|
||||
#else
|
||||
return wxString::FromAscii( WXWIN_OS_DESCRIPTION );
|
||||
#endif
|
||||
FILE *f = popen("uname -s -r -m", "r");
|
||||
if (f)
|
||||
{
|
||||
char buf[256];
|
||||
size_t c = fread(buf, 1, sizeof(buf) - 1, f);
|
||||
pclose(f);
|
||||
// Trim newline from output.
|
||||
if (c && buf[c - 1] == '\n')
|
||||
--c;
|
||||
buf[c] = '\0';
|
||||
return wxString::FromAscii( buf );
|
||||
}
|
||||
wxFAIL_MSG( _T("uname failed") );
|
||||
return _T("");
|
||||
}
|
||||
|
||||
#endif // !__WXMAC__
|
||||
|
Reference in New Issue
Block a user