Files
itgmania212121/stepmania/src/archutils/Unix/GetSysInfo.cpp
T

30 lines
556 B
C++
Raw Normal View History

2003-11-28 21:17:11 +00:00
#include "global.h"
#include "GetSysInfo.h"
#include "RageUtil.h"
#include <sys/utsname.h>
void GetKernel( CString &sys, int &vers )
{
utsname uts;
uname( &uts );
sys = uts.sysname;
vers = 0;
if( sys == "Linux" )
{
static Regex ver( "([0-9]+)\\.([0-9]+)\\.([0-9]+)" );
vector<CString> matches;
if( ver.Compare(uts.release, matches) )
{
ASSERT( matches.size() >= 2 );
int major = atoi(matches[0]);
int minor = atoi(matches[1]);
int revision = atoi(matches[2]);
2004-01-02 07:01:27 +00:00
vers = (major * 10000) + (minor * 100) + (revision);
2003-11-28 21:17:11 +00:00
}
}
}