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_ANDROID) | 6 #if defined(TARGET_OS_ANDROID) |
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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
161 | 161 |
162 bool File::Delete(const char* name) { | 162 bool File::Delete(const char* name) { |
163 int status = TEMP_FAILURE_RETRY(remove(name)); | 163 int status = TEMP_FAILURE_RETRY(remove(name)); |
164 if (status == -1) { | 164 if (status == -1) { |
165 return false; | 165 return false; |
166 } | 166 } |
167 return true; | 167 return true; |
168 } | 168 } |
169 | 169 |
170 | 170 |
171 off_t File::LengthFromName(const char* name) { | 171 off_t File::LengthFromPath(const char* name) { |
Søren Gjesse
2013/02/27 15:20:30
name -> path (for all functions)?
| |
172 struct stat st; | 172 struct stat st; |
173 if (TEMP_FAILURE_RETRY(stat(name, &st)) == 0) { | 173 if (TEMP_FAILURE_RETRY(stat(name, &st)) == 0) { |
174 return st.st_size; | 174 return st.st_size; |
175 } | 175 } |
176 return -1; | 176 return -1; |
177 } | 177 } |
178 | 178 |
179 | 179 |
180 time_t File::LastModified(const char* name) { | 180 time_t File::LastModified(const char* name) { |
181 struct stat st; | 181 struct stat st; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
240 FATAL2("Failed stat on file descriptor %d: %s", fd, strerror(errno)); | 240 FATAL2("Failed stat on file descriptor %d: %s", fd, strerror(errno)); |
241 } | 241 } |
242 if (S_ISCHR(buf.st_mode)) return kTerminal; | 242 if (S_ISCHR(buf.st_mode)) return kTerminal; |
243 if (S_ISFIFO(buf.st_mode)) return kPipe; | 243 if (S_ISFIFO(buf.st_mode)) return kPipe; |
244 if (S_ISSOCK(buf.st_mode)) return kSocket; | 244 if (S_ISSOCK(buf.st_mode)) return kSocket; |
245 if (S_ISREG(buf.st_mode)) return kFile; | 245 if (S_ISREG(buf.st_mode)) return kFile; |
246 return kOther; | 246 return kOther; |
247 } | 247 } |
248 | 248 |
249 #endif // defined(TARGET_OS_ANDROID) | 249 #endif // defined(TARGET_OS_ANDROID) |
OLD | NEW |