| 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 "bin/file.h" | 5 #include "bin/file.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <io.h> | 8 #include <io.h> |
| 9 #include <stdio.h> | 9 #include <stdio.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 } | 155 } |
| 156 return true; | 156 return true; |
| 157 } | 157 } |
| 158 | 158 |
| 159 | 159 |
| 160 bool File::IsAbsolutePath(const char* pathname) { | 160 bool File::IsAbsolutePath(const char* pathname) { |
| 161 // Should we consider network paths? | 161 // Should we consider network paths? |
| 162 if (pathname == NULL) return false; | 162 if (pathname == NULL) return false; |
| 163 return (strlen(pathname) > 2) && | 163 return (strlen(pathname) > 2) && |
| 164 (pathname[1] == ':') && | 164 (pathname[1] == ':') && |
| 165 (pathname[2] == '\\'); | 165 (pathname[2] == '\\' || pathname[2] == '/'); |
| 166 } | 166 } |
| 167 | 167 |
| 168 | 168 |
| 169 char* File::GetCanonicalPath(const char* pathname) { | 169 char* File::GetCanonicalPath(const char* pathname) { |
| 170 struct stat st; | 170 struct stat st; |
| 171 if (stat(pathname, &st) != 0) { | 171 if (stat(pathname, &st) != 0) { |
| 172 SetLastError(ERROR_FILE_NOT_FOUND); | 172 SetLastError(ERROR_FILE_NOT_FOUND); |
| 173 return NULL; | 173 return NULL; |
| 174 } | 174 } |
| 175 int required_size = GetFullPathName(pathname, 0, NULL, NULL); | 175 int required_size = GetFullPathName(pathname, 0, NULL, NULL); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 const char* File::StringEscapedPathSeparator() { | 212 const char* File::StringEscapedPathSeparator() { |
| 213 return "\\\\"; | 213 return "\\\\"; |
| 214 } | 214 } |
| 215 | 215 |
| 216 | 216 |
| 217 File::StdioHandleType File::GetStdioHandleType(int fd) { | 217 File::StdioHandleType File::GetStdioHandleType(int fd) { |
| 218 // Treat all stdio handles as pipes. The Windows event handler and | 218 // Treat all stdio handles as pipes. The Windows event handler and |
| 219 // socket code will handle the different handle types. | 219 // socket code will handle the different handle types. |
| 220 return kPipe; | 220 return kPipe; |
| 221 } | 221 } |
| OLD | NEW |