diff --git a/stepmania/src/archutils/Unix/GetSysInfo.cpp b/stepmania/src/archutils/Unix/GetSysInfo.cpp new file mode 100644 index 0000000000..e4fdcbbc0a --- /dev/null +++ b/stepmania/src/archutils/Unix/GetSysInfo.cpp @@ -0,0 +1,29 @@ +#include "global.h" +#include "GetSysInfo.h" +#include "RageUtil.h" + +#include + +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 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]); + vers = (major << 16) + (minor << 8) + (revision); + } + } +} + diff --git a/stepmania/src/archutils/Unix/GetSysInfo.h b/stepmania/src/archutils/Unix/GetSysInfo.h new file mode 100644 index 0000000000..24d1928069 --- /dev/null +++ b/stepmania/src/archutils/Unix/GetSysInfo.h @@ -0,0 +1,6 @@ +#ifndef GET_SYS_INFO_H + +void GetKernel( CString &sys, int &vers ); + +#endif +