| 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 <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
| 10 #include <unistd.h> | 10 #include <unistd.h> |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 } while (path == NULL && errno == EINTR); | 215 } while (path == NULL && errno == EINTR); |
| 216 return GetCanonicalPath(path); | 216 return GetCanonicalPath(path); |
| 217 } | 217 } |
| 218 | 218 |
| 219 | 219 |
| 220 const char* File::PathSeparator() { | 220 const char* File::PathSeparator() { |
| 221 return "/"; | 221 return "/"; |
| 222 } | 222 } |
| 223 | 223 |
| 224 | 224 |
| 225 char File::PathSeparatorCharacter() { |
| 226 return '/'; |
| 227 } |
| 228 |
| 229 |
| 225 const char* File::StringEscapedPathSeparator() { | 230 const char* File::StringEscapedPathSeparator() { |
| 226 return "/"; | 231 return "/"; |
| 227 } | 232 } |
| 228 | 233 |
| 229 | 234 |
| 230 File::StdioHandleType File::GetStdioHandleType(int fd) { | 235 File::StdioHandleType File::GetStdioHandleType(int fd) { |
| 231 ASSERT(0 <= fd && fd <= 2); | 236 ASSERT(0 <= fd && fd <= 2); |
| 232 struct stat buf; | 237 struct stat buf; |
| 233 int result = fstat(fd, &buf); | 238 int result = fstat(fd, &buf); |
| 234 if (result == -1) { | 239 if (result == -1) { |
| 235 FATAL2("Failed stat on file descriptor %d: %s", fd, strerror(errno)); | 240 FATAL2("Failed stat on file descriptor %d: %s", fd, strerror(errno)); |
| 236 } | 241 } |
| 237 if (S_ISCHR(buf.st_mode)) return kTerminal; | 242 if (S_ISCHR(buf.st_mode)) return kTerminal; |
| 238 if (S_ISFIFO(buf.st_mode)) return kPipe; | 243 if (S_ISFIFO(buf.st_mode)) return kPipe; |
| 239 if (S_ISSOCK(buf.st_mode)) return kSocket; | 244 if (S_ISSOCK(buf.st_mode)) return kSocket; |
| 240 if (S_ISREG(buf.st_mode)) return kFile; | 245 if (S_ISREG(buf.st_mode)) return kFile; |
| 241 return kOther; | 246 return kOther; |
| 242 } | 247 } |
| OLD | NEW |