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 | |
211 bool Platform::LocalHostname(char* buffer, intptr_t buffer_length) { | 201 bool Platform::LocalHostname(char* buffer, intptr_t buffer_length) { |
212 #if defined(DART_IO_DISABLED) || defined(PLATFORM_DISABLE_SOCKET) | 202 #if defined(DART_IO_DISABLED) || defined(PLATFORM_DISABLE_SOCKET) |
213 return false; | 203 return false; |
214 #else | 204 #else |
215 if (!Socket::Initialize()) { | 205 if (!Socket::Initialize()) { |
216 return false; | 206 return false; |
217 } | 207 } |
218 return gethostname(buffer, buffer_length) == 0; | 208 return gethostname(buffer, buffer_length) == 0; |
219 #endif | 209 #endif |
220 } | 210 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 PlatformWin::RestoreConsole(); | 271 PlatformWin::RestoreConsole(); |
282 // On Windows we use ExitProcess so that threads can't clobber the exit_code. | 272 // On Windows we use ExitProcess so that threads can't clobber the exit_code. |
283 // See: https://code.google.com/p/nativeclient/issues/detail?id=2870 | 273 // See: https://code.google.com/p/nativeclient/issues/detail?id=2870 |
284 ::ExitProcess(exit_code); | 274 ::ExitProcess(exit_code); |
285 } | 275 } |
286 | 276 |
287 } // namespace bin | 277 } // namespace bin |
288 } // namespace dart | 278 } // namespace dart |
289 | 279 |
290 #endif // defined(HOST_OS_WINDOWS) | 280 #endif // defined(HOST_OS_WINDOWS) |
OLD | NEW |