OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "platform/globals.h" | 5 #include "platform/globals.h" |
6 #if defined(HOST_OS_WINDOWS) | 6 #if defined(HOST_OS_WINDOWS) |
7 | 7 |
8 #include "bin/platform.h" | 8 #include "bin/platform.h" |
9 | 9 |
10 #include <crtdbg.h> | 10 #include <crtdbg.h> |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 const char* Platform::LibraryPrefix() { | 191 const char* Platform::LibraryPrefix() { |
192 return ""; | 192 return ""; |
193 } | 193 } |
194 | 194 |
195 | 195 |
196 const char* Platform::LibraryExtension() { | 196 const char* Platform::LibraryExtension() { |
197 return "dll"; | 197 return "dll"; |
198 } | 198 } |
199 | 199 |
200 | 200 |
| 201 const char* Platform::LocaleName() { |
| 202 wchar_t locale_name[LOCALE_NAME_MAX_LENGTH]; |
| 203 int result = GetUserDefaultLocaleName(locale_name, LOCALE_NAME_MAX_LENGTH); |
| 204 if (result == 0) { |
| 205 return NULL; |
| 206 } |
| 207 return StringUtilsWin::WideToUtf8(locale_name); |
| 208 } |
| 209 |
| 210 |
201 bool Platform::LocalHostname(char* buffer, intptr_t buffer_length) { | 211 bool Platform::LocalHostname(char* buffer, intptr_t buffer_length) { |
202 #if defined(DART_IO_DISABLED) || defined(PLATFORM_DISABLE_SOCKET) | 212 #if defined(DART_IO_DISABLED) || defined(PLATFORM_DISABLE_SOCKET) |
203 return false; | 213 return false; |
204 #else | 214 #else |
205 if (!Socket::Initialize()) { | 215 if (!Socket::Initialize()) { |
206 return false; | 216 return false; |
207 } | 217 } |
208 return gethostname(buffer, buffer_length) == 0; | 218 return gethostname(buffer, buffer_length) == 0; |
209 #endif | 219 #endif |
210 } | 220 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 PlatformWin::RestoreConsole(); | 281 PlatformWin::RestoreConsole(); |
272 // On Windows we use ExitProcess so that threads can't clobber the exit_code. | 282 // On Windows we use ExitProcess so that threads can't clobber the exit_code. |
273 // See: https://code.google.com/p/nativeclient/issues/detail?id=2870 | 283 // See: https://code.google.com/p/nativeclient/issues/detail?id=2870 |
274 ::ExitProcess(exit_code); | 284 ::ExitProcess(exit_code); |
275 } | 285 } |
276 | 286 |
277 } // namespace bin | 287 } // namespace bin |
278 } // namespace dart | 288 } // namespace dart |
279 | 289 |
280 #endif // defined(HOST_OS_WINDOWS) | 290 #endif // defined(HOST_OS_WINDOWS) |
OLD | NEW |