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