| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |