| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 if (*tmp != '=') { | 252 if (*tmp != '=') { |
| 253 result[current++] = StringUtilsWin::WideToUtf8(tmp); | 253 result[current++] = StringUtilsWin::WideToUtf8(tmp); |
| 254 } | 254 } |
| 255 tmp += (wcslen(tmp) + 1); | 255 tmp += (wcslen(tmp) + 1); |
| 256 } | 256 } |
| 257 FreeEnvironmentStringsW(strings); | 257 FreeEnvironmentStringsW(strings); |
| 258 return result; | 258 return result; |
| 259 } | 259 } |
| 260 | 260 |
| 261 | 261 |
| 262 const char* Platform::GetExecutableName() { |
| 263 return executable_name_; |
| 264 } |
| 265 |
| 266 |
| 262 const char* Platform::ResolveExecutablePath() { | 267 const char* Platform::ResolveExecutablePath() { |
| 263 // GetModuleFileNameW cannot directly provide information on the | 268 // GetModuleFileNameW cannot directly provide information on the |
| 264 // required buffer size, so start out with a buffer large enough to | 269 // required buffer size, so start out with a buffer large enough to |
| 265 // hold any Windows path. | 270 // hold any Windows path. |
| 266 const int kTmpBufferSize = 32768; | 271 const int kTmpBufferSize = 32768; |
| 267 wchar_t* tmp_buffer = | 272 wchar_t* tmp_buffer = |
| 268 reinterpret_cast<wchar_t*>(Dart_ScopeAllocate(kTmpBufferSize)); | 273 reinterpret_cast<wchar_t*>(Dart_ScopeAllocate(kTmpBufferSize)); |
| 269 // Ensure no last error before calling GetModuleFileNameW. | 274 // Ensure no last error before calling GetModuleFileNameW. |
| 270 SetLastError(ERROR_SUCCESS); | 275 SetLastError(ERROR_SUCCESS); |
| 271 // Get the required length of the buffer. | 276 // Get the required length of the buffer. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 287 PlatformWin::RestoreConsole(); | 292 PlatformWin::RestoreConsole(); |
| 288 // On Windows we use ExitProcess so that threads can't clobber the exit_code. | 293 // On Windows we use ExitProcess so that threads can't clobber the exit_code. |
| 289 // See: https://code.google.com/p/nativeclient/issues/detail?id=2870 | 294 // See: https://code.google.com/p/nativeclient/issues/detail?id=2870 |
| 290 ::ExitProcess(exit_code); | 295 ::ExitProcess(exit_code); |
| 291 } | 296 } |
| 292 | 297 |
| 293 } // namespace bin | 298 } // namespace bin |
| 294 } // namespace dart | 299 } // namespace dart |
| 295 | 300 |
| 296 #endif // defined(HOST_OS_WINDOWS) | 301 #endif // defined(HOST_OS_WINDOWS) |
| OLD | NEW |