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 <errno.h> | 5 #include <errno.h> |
6 #include <fcntl.h> | 6 #include <fcntl.h> |
7 #include <sys/stat.h> | 7 #include <sys/stat.h> |
8 #include <unistd.h> | 8 #include <unistd.h> |
9 #include <libgen.h> | 9 #include <libgen.h> |
10 | 10 |
11 #include "bin/builtin.h" | 11 #include "bin/builtin.h" |
12 #include "bin/file.h" | 12 #include "bin/file.h" |
Ivan Posva
2012/01/13 23:22:06
file.h first as this is really the file.cc
Søren Gjesse
2012/01/16 08:58:00
Done.
| |
13 | 13 |
14 class FileHandle { | 14 class FileHandle { |
15 public: | 15 public: |
16 explicit FileHandle(int fd) : fd_(fd) { } | 16 explicit FileHandle(int fd) : fd_(fd) { } |
17 ~FileHandle() { } | 17 ~FileHandle() { } |
18 int fd() const { return fd_; } | 18 int fd() const { return fd_; } |
19 void set_fd(int fd) { fd_ = fd; } | 19 void set_fd(int fd) { fd_ = fd; } |
20 | 20 |
21 private: | 21 private: |
22 int fd_; | 22 int fd_; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
151 return (pathname != NULL && pathname[0] == '/'); | 151 return (pathname != NULL && pathname[0] == '/'); |
152 } | 152 } |
153 | 153 |
154 | 154 |
155 char* File::GetCanonicalPath(const char* pathname) { | 155 char* File::GetCanonicalPath(const char* pathname) { |
156 char* abs_path = NULL; | 156 char* abs_path = NULL; |
157 if (pathname != NULL) { | 157 if (pathname != NULL) { |
158 do { | 158 do { |
159 abs_path = realpath(pathname, NULL); | 159 abs_path = realpath(pathname, NULL); |
160 } while (abs_path == NULL && errno == EINTR); | 160 } while (abs_path == NULL && errno == EINTR); |
161 assert(abs_path == NULL || IsAbsolutePath(abs_path)); | 161 ASSERT(abs_path == NULL || IsAbsolutePath(abs_path)); |
162 } | 162 } |
163 return abs_path; | 163 return abs_path; |
164 } | 164 } |
165 | 165 |
166 | 166 |
167 const char* File::PathSeparator() { | 167 const char* File::PathSeparator() { |
168 return "/"; | 168 return "/"; |
169 } | 169 } |
170 | 170 |
171 | 171 |
172 const char* File::StringEscapedPathSeparator() { | 172 const char* File::StringEscapedPathSeparator() { |
173 return "/"; | 173 return "/"; |
174 } | 174 } |
OLD | NEW |