From da6b89c1859b84f7f1e1247c20392ad0c59faf81 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Mon, 17 Dec 2018 10:47:34 +0200 Subject: [PATCH] [General] Add getOperatingSystem() to multiplayer Utils --- components/openmw-mp/Utils.cpp | 21 ++++++++++++--------- components/openmw-mp/Utils.hpp | 2 ++ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/components/openmw-mp/Utils.cpp b/components/openmw-mp/Utils.cpp index be9cc737b..11603beac 100644 --- a/components/openmw-mp/Utils.cpp +++ b/components/openmw-mp/Utils.cpp @@ -117,7 +117,7 @@ std::string Utils::toString(int num) return stream.str(); } -string Utils::replaceString(const string& source, const char* find, const char* replace) +std::string Utils::replaceString(const string& source, const char* find, const char* replace) { unsigned int find_len = strlen(find); unsigned int replace_len = strlen(replace); @@ -175,20 +175,23 @@ unsigned int ::Utils::crc32Checksum(const std::string &file) return crc32.checksum(); } -void Utils::printVersion(std::string appName, std::string version, std::string commitHash, int protocol) +std::string Utils::getOperatingSystem() { - cout << appName << " " << version; - cout << " ("; #if defined(_WIN32) - cout << "Windows"; + return "Windows"; #elif defined(__linux) - cout << "Linux"; + return "Linux"; #elif defined(__APPLE__) - cout << "OS X"; + return "OS X"; #else - cout << "Unknown OS"; + return "Unknown OS"; #endif - cout << " "; +} + +void Utils::printVersion(std::string appName, std::string version, std::string commitHash, int protocol) +{ + cout << appName << " " << version; + cout << " (" << getOperatingSystem() << " "; #if defined(__x86_64__) || defined(_M_X64) cout << "64-bit"; #elif defined(__i386__) || defined(_M_I86) diff --git a/components/openmw-mp/Utils.hpp b/components/openmw-mp/Utils.hpp index 98850c1ae..9fc4fded5 100644 --- a/components/openmw-mp/Utils.hpp +++ b/components/openmw-mp/Utils.hpp @@ -60,6 +60,8 @@ namespace Utils unsigned int crc32Checksum(const std::string &file); + std::string getOperatingSystem(); + void printVersion(std::string appName, std::string version, std::string commitHash, int protocol); void printWithWidth(std::ostringstream &sstr, std::string str, size_t width);