Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: runtime/bin/platform_win.cc

Issue 2786183003: [dart:io] Reland: Adds Platform.localeName (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/bin/platform_unsupported.cc ('k') | sdk/lib/_internal/js_runtime/lib/io_patch.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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)
OLDNEW
« no previous file with comments | « runtime/bin/platform_unsupported.cc ('k') | sdk/lib/_internal/js_runtime/lib/io_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698