| 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 reinterpret_cast<wchar_t*>(Dart_ScopeAllocate(kTmpBufferSize)); | 286 reinterpret_cast<wchar_t*>(Dart_ScopeAllocate(kTmpBufferSize)); |
| 287 // Ensure no last error before calling GetModuleFileNameW. | 287 // Ensure no last error before calling GetModuleFileNameW. |
| 288 SetLastError(ERROR_SUCCESS); | 288 SetLastError(ERROR_SUCCESS); |
| 289 // Get the required length of the buffer. | 289 // Get the required length of the buffer. |
| 290 int path_length = GetModuleFileNameW(NULL, tmp_buffer, kTmpBufferSize); | 290 int path_length = GetModuleFileNameW(NULL, tmp_buffer, kTmpBufferSize); |
| 291 if (GetLastError() != ERROR_SUCCESS) { | 291 if (GetLastError() != ERROR_SUCCESS) { |
| 292 return NULL; | 292 return NULL; |
| 293 } | 293 } |
| 294 char* path = StringUtilsWin::WideToUtf8(tmp_buffer); | 294 char* path = StringUtilsWin::WideToUtf8(tmp_buffer); |
| 295 // Return the canonical path as the returned path might contain symlinks. | 295 // Return the canonical path as the returned path might contain symlinks. |
| 296 const char* canon_path = File::GetCanonicalPath(path); | 296 const char* canon_path = File::GetCanonicalPath(NULL, path); |
| 297 return canon_path; | 297 return canon_path; |
| 298 } | 298 } |
| 299 | 299 |
| 300 void Platform::Exit(int exit_code) { | 300 void Platform::Exit(int exit_code) { |
| 301 // TODO(zra): Remove once VM shuts down cleanly. | 301 // TODO(zra): Remove once VM shuts down cleanly. |
| 302 ::dart::private_flag_windows_run_tls_destructors = false; | 302 ::dart::private_flag_windows_run_tls_destructors = false; |
| 303 // Restore the console's output code page | 303 // Restore the console's output code page |
| 304 PlatformWin::RestoreConsole(); | 304 PlatformWin::RestoreConsole(); |
| 305 // On Windows we use ExitProcess so that threads can't clobber the exit_code. | 305 // On Windows we use ExitProcess so that threads can't clobber the exit_code. |
| 306 // See: https://code.google.com/p/nativeclient/issues/detail?id=2870 | 306 // See: https://code.google.com/p/nativeclient/issues/detail?id=2870 |
| 307 ::ExitProcess(exit_code); | 307 ::ExitProcess(exit_code); |
| 308 } | 308 } |
| 309 | 309 |
| 310 } // namespace bin | 310 } // namespace bin |
| 311 } // namespace dart | 311 } // namespace dart |
| 312 | 312 |
| 313 #endif // defined(HOST_OS_WINDOWS) | 313 #endif // defined(HOST_OS_WINDOWS) |
| OLD | NEW |