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 "platform/globals.h" | 5 #include "platform/globals.h" |
6 #if defined(TARGET_OS_MACOS) | 6 #if defined(TARGET_OS_MACOS) |
7 | 7 |
8 #include "bin/file.h" | 8 #include "bin/file.h" |
9 | 9 |
10 #include <errno.h> // NOLINT | 10 #include <errno.h> // NOLINT |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 163 |
164 bool File::Delete(const char* name) { | 164 bool File::Delete(const char* name) { |
165 int status = TEMP_FAILURE_RETRY(remove(name)); | 165 int status = TEMP_FAILURE_RETRY(remove(name)); |
166 if (status == -1) { | 166 if (status == -1) { |
167 return false; | 167 return false; |
168 } | 168 } |
169 return true; | 169 return true; |
170 } | 170 } |
171 | 171 |
172 | 172 |
173 off_t File::LengthFromName(const char* name) { | 173 off_t File::LengthFromPath(const char* name) { |
174 struct stat st; | 174 struct stat st; |
175 if (TEMP_FAILURE_RETRY(stat(name, &st)) == 0) { | 175 if (TEMP_FAILURE_RETRY(stat(name, &st)) == 0) { |
176 return st.st_size; | 176 return st.st_size; |
177 } | 177 } |
178 return -1; | 178 return -1; |
179 } | 179 } |
180 | 180 |
181 | 181 |
182 time_t File::LastModified(const char* name) { | 182 time_t File::LastModified(const char* name) { |
183 struct stat st; | 183 struct stat st; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 FATAL2("Failed stat on file descriptor %d: %s", fd, strerror(errno)); | 248 FATAL2("Failed stat on file descriptor %d: %s", fd, strerror(errno)); |
249 } | 249 } |
250 if (S_ISCHR(buf.st_mode)) return kTerminal; | 250 if (S_ISCHR(buf.st_mode)) return kTerminal; |
251 if (S_ISFIFO(buf.st_mode)) return kPipe; | 251 if (S_ISFIFO(buf.st_mode)) return kPipe; |
252 if (S_ISSOCK(buf.st_mode)) return kSocket; | 252 if (S_ISSOCK(buf.st_mode)) return kSocket; |
253 if (S_ISREG(buf.st_mode)) return kFile; | 253 if (S_ISREG(buf.st_mode)) return kFile; |
254 return kOther; | 254 return kOther; |
255 } | 255 } |
256 | 256 |
257 #endif // defined(TARGET_OS_MACOS) | 257 #endif // defined(TARGET_OS_MACOS) |
OLD | NEW |