]> git.tdb.fi Git - builder.git/blobdiff - source/sysutils.cpp
Move system-specific code to a separate file
[builder.git] / source / sysutils.cpp
diff --git a/source/sysutils.cpp b/source/sysutils.cpp
new file mode 100644 (file)
index 0000000..6e1828c
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef _WIN32
+#include <sys/utsname.h>
+#endif
+#include <msp/strings/format.h>
+#include <msp/strings/utils.h>
+#include "sysutils.h"
+
+using namespace std;
+using namespace Msp;
+
+string get_system_type()
+{
+#ifdef _WIN32
+       return "windows";
+#else
+       utsname un;
+       if(uname(&un)==0)
+               return tolower(format("%s-%s", un.sysname, un.machine));
+#endif
+
+       return string();
+}