mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-28 10:39:40 +00:00
[General] Add getOperatingSystem() to multiplayer Utils
This commit is contained in:
parent
50714599d9
commit
da6b89c185
2 changed files with 17 additions and 12 deletions
|
@ -117,7 +117,7 @@ std::string Utils::toString(int num)
|
||||||
return stream.str();
|
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 find_len = strlen(find);
|
||||||
unsigned int replace_len = strlen(replace);
|
unsigned int replace_len = strlen(replace);
|
||||||
|
@ -175,20 +175,23 @@ unsigned int ::Utils::crc32Checksum(const std::string &file)
|
||||||
return crc32.checksum();
|
return crc32.checksum();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Utils::getOperatingSystem()
|
||||||
|
{
|
||||||
|
#if defined(_WIN32)
|
||||||
|
return "Windows";
|
||||||
|
#elif defined(__linux)
|
||||||
|
return "Linux";
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
return "OS X";
|
||||||
|
#else
|
||||||
|
return "Unknown OS";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void Utils::printVersion(std::string appName, std::string version, std::string commitHash, int protocol)
|
void Utils::printVersion(std::string appName, std::string version, std::string commitHash, int protocol)
|
||||||
{
|
{
|
||||||
cout << appName << " " << version;
|
cout << appName << " " << version;
|
||||||
cout << " (";
|
cout << " (" << getOperatingSystem() << " ";
|
||||||
#if defined(_WIN32)
|
|
||||||
cout << "Windows";
|
|
||||||
#elif defined(__linux)
|
|
||||||
cout << "Linux";
|
|
||||||
#elif defined(__APPLE__)
|
|
||||||
cout << "OS X";
|
|
||||||
#else
|
|
||||||
cout << "Unknown OS";
|
|
||||||
#endif
|
|
||||||
cout << " ";
|
|
||||||
#if defined(__x86_64__) || defined(_M_X64)
|
#if defined(__x86_64__) || defined(_M_X64)
|
||||||
cout << "64-bit";
|
cout << "64-bit";
|
||||||
#elif defined(__i386__) || defined(_M_I86)
|
#elif defined(__i386__) || defined(_M_I86)
|
||||||
|
|
|
@ -60,6 +60,8 @@ namespace Utils
|
||||||
|
|
||||||
unsigned int crc32Checksum(const std::string &file);
|
unsigned int crc32Checksum(const std::string &file);
|
||||||
|
|
||||||
|
std::string getOperatingSystem();
|
||||||
|
|
||||||
void printVersion(std::string appName, std::string version, std::string commitHash, int protocol);
|
void printVersion(std::string appName, std::string version, std::string commitHash, int protocol);
|
||||||
|
|
||||||
void printWithWidth(std::ostringstream &sstr, std::string str, size_t width);
|
void printWithWidth(std::ostringstream &sstr, std::string str, size_t width);
|
||||||
|
|
Loading…
Reference in a new issue