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

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

Issue 1178643007: Resolve the executable path on Mac OS when sym-linked (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Addressed review comments Created 5 years, 6 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 | « no previous file | tests/standalone/io/platform_executable_test.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(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
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)
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/io/platform_executable_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698