[General] Add getArchitectureType() to multiplayer Utils

Additionally, rename getOperatingSystem() into getOperatingSystemType() for clarity.
pull/496/head
David Cernat 6 years ago
parent fa1700e2ab
commit 9fe54aa8c6

@ -175,7 +175,7 @@ unsigned int ::Utils::crc32Checksum(const std::string &file)
return crc32.checksum();
}
std::string Utils::getOperatingSystem()
std::string Utils::getOperatingSystemType()
{
#if defined(_WIN32)
return "Windows";
@ -188,25 +188,28 @@ std::string Utils::getOperatingSystem()
#endif
}
void Utils::printVersion(std::string appName, std::string version, std::string commitHash, int protocol)
std::string Utils::getArchitectureType()
{
cout << appName << " " << version;
cout << " (" << getOperatingSystem() << " ";
#if defined(__x86_64__) || defined(_M_X64)
cout << "64-bit";
return "64-bit";
#elif defined(__i386__) || defined(_M_I86)
cout << "32-bit";
return "32-bit";
#elif defined(__ARM_ARCH)
cout << "ARMv" << __ARM_ARCH << " ";
return "ARMv" + __ARM_ARCH;
#ifdef __aarch64__
cout << "64-bit";
return "64-bit";
#else
cout << "32-bit";
return "32-bit";
#endif
#else
cout << "Unknown architecture";
return "Unknown architecture";
#endif
cout << ")" << endl;
}
void Utils::printVersion(std::string appName, std::string version, std::string commitHash, int protocol)
{
cout << appName << " " << version;
cout << " (" << getOperatingSystemType() << " " << getArchitectureType() << ")" << endl;
cout << "Protocol version: " << protocol << endl;
cout << "Commit hash: " << commitHash.substr(0, 10) << endl;

@ -60,7 +60,8 @@ namespace Utils
unsigned int crc32Checksum(const std::string &file);
std::string getOperatingSystem();
std::string getOperatingSystemType();
std::string getArchitectureType();
void printVersion(std::string appName, std::string version, std::string commitHash, int protocol);

Loading…
Cancel
Save