| 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(TARGET_OS_WINDOWS) | 6 #if defined(TARGET_OS_WINDOWS) |
| 7 | 7 |
| 8 #include "bin/file.h" |
| 8 #include "bin/platform.h" | 9 #include "bin/platform.h" |
| 9 #include "bin/log.h" | 10 #include "bin/log.h" |
| 10 #include "bin/socket.h" | 11 #include "bin/socket.h" |
| 11 #include "bin/utils.h" | 12 #include "bin/utils.h" |
| 12 | 13 |
| 13 | 14 |
| 14 namespace dart { | 15 namespace dart { |
| 15 namespace bin { | 16 namespace bin { |
| 16 | 17 |
| 17 bool Platform::Initialize() { | 18 bool Platform::Initialize() { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // Ensure no last error before calling GetModuleFileNameW. | 91 // Ensure no last error before calling GetModuleFileNameW. |
| 91 SetLastError(ERROR_SUCCESS); | 92 SetLastError(ERROR_SUCCESS); |
| 92 // Get the required length of the buffer. | 93 // Get the required length of the buffer. |
| 93 int path_length = GetModuleFileNameW(NULL, tmp_buffer, kTmpBufferSize); | 94 int path_length = GetModuleFileNameW(NULL, tmp_buffer, kTmpBufferSize); |
| 94 if (GetLastError() != ERROR_SUCCESS) { | 95 if (GetLastError() != ERROR_SUCCESS) { |
| 95 free(tmp_buffer); | 96 free(tmp_buffer); |
| 96 return NULL; | 97 return NULL; |
| 97 } | 98 } |
| 98 char* path = StringUtils::WideToUtf8(tmp_buffer); | 99 char* path = StringUtils::WideToUtf8(tmp_buffer); |
| 99 free(tmp_buffer); | 100 free(tmp_buffer); |
| 100 return path; | 101 // Return the canonical path as the returned path might contain symlinks. |
| 102 char* canon_path = File::GetCanonicalPath(path); |
| 103 free(path); |
| 104 return canon_path; |
| 101 } | 105 } |
| 102 | 106 |
| 103 } // namespace bin | 107 } // namespace bin |
| 104 } // namespace dart | 108 } // namespace dart |
| 105 | 109 |
| 106 #endif // defined(TARGET_OS_WINDOWS) | 110 #endif // defined(TARGET_OS_WINDOWS) |
| OLD | NEW |