[General] Add getOperatingSystem() to multiplayer Utils

experimental-mono
David Cernat 6 years ago
parent 50714599d9
commit da6b89c185

@ -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)

@ -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);

Loading…
Cancel
Save