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

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

Issue 8394041: Implement path canonicalization on Windows to fix infinite loop on cyclic includes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/language/language.status » ('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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 <fcntl.h> 5 #include <fcntl.h>
6 #include <io.h> 6 #include <io.h>
7 #include <stdio.h> 7 #include <stdio.h>
8 #include <string.h> 8 #include <string.h>
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 10
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 bool File::IsAbsolutePath(const char* pathname) { 114 bool File::IsAbsolutePath(const char* pathname) {
115 // Should we consider network paths? 115 // Should we consider network paths?
116 if (pathname == NULL) return false; 116 if (pathname == NULL) return false;
117 return (strlen(pathname) > 2) && 117 return (strlen(pathname) > 2) &&
118 (pathname[1] == ':') && 118 (pathname[1] == ':') &&
119 (pathname[2] == '\\'); 119 (pathname[2] == '\\');
120 } 120 }
121 121
122 122
123 char* File::GetCanonicalPath(const char* pathname) { 123 char* File::GetCanonicalPath(const char* pathname) {
124 // TODO(176): Need to implement this. 124 int required_size = GetFullPathName(pathname, 0, NULL, NULL);
125 return strdup(pathname); 125 char* path = static_cast<char*>(malloc(required_size));
126 int written = GetFullPathName(pathname, required_size, path, NULL);
127 ASSERT(written == (required_size - 1));
128 return path;
126 } 129 }
127 130
128 131
129 const char* File::PathSeparator() { 132 const char* File::PathSeparator() {
130 return "\\"; 133 return "\\";
131 } 134 }
132 135
133 136
134 const char* File::StringEscapedPathSeparator() { 137 const char* File::StringEscapedPathSeparator() {
135 return "\\\\"; 138 return "\\\\";
136 } 139 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698