forked from mirror/openmw-tes3mp
[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();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
cout << appName << " " << version;
|
||||
cout << " (";
|
||||
#if defined(_WIN32)
|
||||
cout << "Windows";
|
||||
#elif defined(__linux)
|
||||
cout << "Linux";
|
||||
#elif defined(__APPLE__)
|
||||
cout << "OS X";
|
||||
#else
|
||||
cout << "Unknown OS";
|
||||
#endif
|
||||
cout << " ";
|
||||
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…
Reference in a new issue