diff options
author | Jacek Antonelli | 2008-08-15 23:45:19 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:19 -0500 |
commit | b235c59d60472f818a9142c0886b95a0ff4191d7 (patch) | |
tree | d323c55587584b19cc43a03f58a178823f12d3cd /linden/indra/llcommon/llsys.cpp | |
parent | Second Life viewer sources 1.18.5.3 (diff) | |
download | meta-impy-b235c59d60472f818a9142c0886b95a0ff4191d7.zip meta-impy-b235c59d60472f818a9142c0886b95a0ff4191d7.tar.gz meta-impy-b235c59d60472f818a9142c0886b95a0ff4191d7.tar.bz2 meta-impy-b235c59d60472f818a9142c0886b95a0ff4191d7.tar.xz |
Second Life viewer sources 1.18.6.0-RC
Diffstat (limited to 'linden/indra/llcommon/llsys.cpp')
-rw-r--r-- | linden/indra/llcommon/llsys.cpp | 77 |
1 files changed, 53 insertions, 24 deletions
diff --git a/linden/indra/llcommon/llsys.cpp b/linden/indra/llcommon/llsys.cpp index 3b57db7..7346b29 100644 --- a/linden/indra/llcommon/llsys.cpp +++ b/linden/indra/llcommon/llsys.cpp | |||
@@ -65,8 +65,7 @@ static const S32 CPUINFO_BUFFER_SIZE = 16383; | |||
65 | LLCPUInfo gSysCPU; | 65 | LLCPUInfo gSysCPU; |
66 | 66 | ||
67 | LLOSInfo::LLOSInfo() : | 67 | LLOSInfo::LLOSInfo() : |
68 | mMajorVer(0), mMinorVer(0), mBuild(0), | 68 | mMajorVer(0), mMinorVer(0), mBuild(0) |
69 | mOSString("") | ||
70 | { | 69 | { |
71 | 70 | ||
72 | #if LL_WINDOWS | 71 | #if LL_WINDOWS |
@@ -94,27 +93,28 @@ LLOSInfo::LLOSInfo() : | |||
94 | // Test for the product. | 93 | // Test for the product. |
95 | if(osvi.dwMajorVersion <= 4) | 94 | if(osvi.dwMajorVersion <= 4) |
96 | { | 95 | { |
97 | mOSString = "Microsoft Windows NT "; | 96 | mOSStringSimple = "Microsoft Windows NT "; |
98 | } | 97 | } |
99 | else if(osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0) | 98 | else if(osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0) |
100 | { | 99 | { |
101 | mOSString = "Microsoft Windows 2000 "; | 100 | mOSStringSimple = "Microsoft Windows 2000 "; |
102 | } | 101 | } |
103 | else if(osvi.dwMajorVersion ==5 && osvi.dwMinorVersion == 1) | 102 | else if(osvi.dwMajorVersion ==5 && osvi.dwMinorVersion == 1) |
104 | { | 103 | { |
105 | mOSString = "Microsoft Windows XP "; | 104 | mOSStringSimple = "Microsoft Windows XP "; |
106 | } | 105 | } |
107 | else if(osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2) | 106 | else if(osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2) |
108 | { | 107 | { |
109 | if(osvi.wProductType == VER_NT_WORKSTATION) | 108 | if(osvi.wProductType == VER_NT_WORKSTATION) |
110 | mOSString = "Microsoft Windows XP x64 Edition "; | 109 | mOSStringSimple = "Microsoft Windows XP x64 Edition "; |
111 | else mOSString = "Microsoft Windows Server 2003 "; | 110 | else |
111 | mOSStringSimple = "Microsoft Windows Server 2003 "; | ||
112 | } | 112 | } |
113 | else if(osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0) | 113 | else if(osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0) |
114 | { | 114 | { |
115 | if(osvi.wProductType == VER_NT_WORKSTATION) | 115 | if(osvi.wProductType == VER_NT_WORKSTATION) |
116 | mOSString = "Microsoft Windows Vista "; | 116 | mOSStringSimple = "Microsoft Windows Vista "; |
117 | else mOSString = "Microsoft Windows Vista Server "; | 117 | else mOSStringSimple = "Microsoft Windows Vista Server "; |
118 | } | 118 | } |
119 | else // Use the registry on early versions of Windows NT. | 119 | else // Use the registry on early versions of Windows NT. |
120 | { | 120 | { |
@@ -129,15 +129,15 @@ LLOSInfo::LLOSInfo() : | |||
129 | RegCloseKey( hKey ); | 129 | RegCloseKey( hKey ); |
130 | if ( lstrcmpi( L"WINNT", szProductType) == 0 ) | 130 | if ( lstrcmpi( L"WINNT", szProductType) == 0 ) |
131 | { | 131 | { |
132 | mOSString += "Professional "; | 132 | mOSStringSimple += "Professional "; |
133 | } | 133 | } |
134 | else if ( lstrcmpi( L"LANMANNT", szProductType) == 0 ) | 134 | else if ( lstrcmpi( L"LANMANNT", szProductType) == 0 ) |
135 | { | 135 | { |
136 | mOSString += "Server "; | 136 | mOSStringSimple += "Server "; |
137 | } | 137 | } |
138 | else if ( lstrcmpi( L"SERVERNT", szProductType) == 0 ) | 138 | else if ( lstrcmpi( L"SERVERNT", szProductType) == 0 ) |
139 | { | 139 | { |
140 | mOSString += "Advanced Server "; | 140 | mOSStringSimple += "Advanced Server "; |
141 | } | 141 | } |
142 | } | 142 | } |
143 | 143 | ||
@@ -164,7 +164,7 @@ LLOSInfo::LLOSInfo() : | |||
164 | csdversion.c_str(), | 164 | csdversion.c_str(), |
165 | (osvi.dwBuildNumber & 0xffff)); | 165 | (osvi.dwBuildNumber & 0xffff)); |
166 | } | 166 | } |
167 | mOSString += tmp; | 167 | mOSString = mOSStringSimple + tmp; |
168 | } | 168 | } |
169 | break; | 169 | break; |
170 | 170 | ||
@@ -172,41 +172,65 @@ LLOSInfo::LLOSInfo() : | |||
172 | // Test for the Windows 95 product family. | 172 | // Test for the Windows 95 product family. |
173 | if(osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0) | 173 | if(osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0) |
174 | { | 174 | { |
175 | mOSString = "Microsoft Windows 95 "; | 175 | mOSStringSimple = "Microsoft Windows 95 "; |
176 | if ( osvi.szCSDVersion[1] == 'C' || osvi.szCSDVersion[1] == 'B' ) | 176 | if ( osvi.szCSDVersion[1] == 'C' || osvi.szCSDVersion[1] == 'B' ) |
177 | { | 177 | { |
178 | mOSString += "OSR2 "; | 178 | mOSStringSimple += "OSR2 "; |
179 | } | 179 | } |
180 | } | 180 | } |
181 | if(osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10) | 181 | if(osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10) |
182 | { | 182 | { |
183 | mOSString = "Microsoft Windows 98 "; | 183 | mOSStringSimple = "Microsoft Windows 98 "; |
184 | if ( osvi.szCSDVersion[1] == 'A' ) | 184 | if ( osvi.szCSDVersion[1] == 'A' ) |
185 | { | 185 | { |
186 | mOSString += "SE "; | 186 | mOSStringSimple += "SE "; |
187 | } | 187 | } |
188 | } | 188 | } |
189 | if(osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90) | 189 | if(osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90) |
190 | { | 190 | { |
191 | mOSString = "Microsoft Windows Millennium Edition "; | 191 | mOSStringSimple = "Microsoft Windows Millennium Edition "; |
192 | } | 192 | } |
193 | mOSString = mOSStringSimple; | ||
193 | break; | 194 | break; |
194 | } | 195 | } |
195 | #else | 196 | #else |
196 | struct utsname un; | 197 | struct utsname un; |
197 | if(uname(&un) != -1) | 198 | if(uname(&un) != -1) |
198 | { | 199 | { |
199 | mOSString.append(un.sysname); | 200 | mOSStringSimple.append(un.sysname); |
200 | mOSString.append(" "); | 201 | mOSStringSimple.append(" "); |
201 | mOSString.append(un.release); | 202 | mOSStringSimple.append(un.release); |
203 | |||
204 | mOSString = mOSStringSimple; | ||
202 | mOSString.append(" "); | 205 | mOSString.append(" "); |
203 | mOSString.append(un.version); | 206 | mOSString.append(un.version); |
204 | mOSString.append(" "); | 207 | mOSString.append(" "); |
205 | mOSString.append(un.machine); | 208 | mOSString.append(un.machine); |
209 | |||
210 | // Simplify 'Simple' | ||
211 | std::string ostype = mOSStringSimple.substr(0, mOSStringSimple.find_first_of(" ", 0)); | ||
212 | if (ostype == "Darwin") | ||
213 | { | ||
214 | // Only care about major Darwin versions, truncate at first '.' | ||
215 | S32 idx1 = mOSStringSimple.find_first_of(".", 0); | ||
216 | std::string simple = mOSStringSimple.substr(0, idx1); | ||
217 | if (simple.length() > 0) | ||
218 | mOSStringSimple = simple; | ||
219 | } | ||
220 | else if (ostype == "Linux") | ||
221 | { | ||
222 | // Only care about major and minor Linux versions, truncate at second '.' | ||
223 | S32 idx1 = mOSStringSimple.find_first_of(".", 0); | ||
224 | S32 idx2 = (idx1 != std::string::npos) ? mOSStringSimple.find_first_of(".", idx1+1) : std::string::npos; | ||
225 | std::string simple = mOSStringSimple.substr(0, idx2); | ||
226 | if (simple.length() > 0) | ||
227 | mOSStringSimple = simple; | ||
228 | } | ||
206 | } | 229 | } |
207 | else | 230 | else |
208 | { | 231 | { |
209 | mOSString.append("Unable to collect OS info"); | 232 | mOSStringSimple.append("Unable to collect OS info"); |
233 | mOSString = mOSStringSimple; | ||
210 | } | 234 | } |
211 | #endif | 235 | #endif |
212 | 236 | ||
@@ -255,6 +279,11 @@ const std::string& LLOSInfo::getOSString() const | |||
255 | return mOSString; | 279 | return mOSString; |
256 | } | 280 | } |
257 | 281 | ||
282 | const std::string& LLOSInfo::getOSStringSimple() const | ||
283 | { | ||
284 | return mOSStringSimple; | ||
285 | } | ||
286 | |||
258 | const S32 STATUS_SIZE = 8192; | 287 | const S32 STATUS_SIZE = 8192; |
259 | 288 | ||
260 | //static | 289 | //static |