| 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 } else { | 280 } else { |
| 281 stat_success = TEMP_FAILURE_RETRY(lstat(pathname, &entry_info)); | 281 stat_success = TEMP_FAILURE_RETRY(lstat(pathname, &entry_info)); |
| 282 } | 282 } |
| 283 if (stat_success == -1) return File::kDoesNotExist; | 283 if (stat_success == -1) return File::kDoesNotExist; |
| 284 if (S_ISDIR(entry_info.st_mode)) return File::kIsDirectory; | 284 if (S_ISDIR(entry_info.st_mode)) return File::kIsDirectory; |
| 285 if (S_ISREG(entry_info.st_mode)) return File::kIsFile; | 285 if (S_ISREG(entry_info.st_mode)) return File::kIsFile; |
| 286 if (S_ISLNK(entry_info.st_mode)) return File::kIsLink; | 286 if (S_ISLNK(entry_info.st_mode)) return File::kIsLink; |
| 287 return File::kDoesNotExist; | 287 return File::kDoesNotExist; |
| 288 } | 288 } |
| 289 | 289 |
| 290 |
| 291 File::Identical File::AreIdentical(const char* file_1, const char* file_2) { |
| 292 struct stat file_1_info; |
| 293 struct stat file_2_info; |
| 294 if (TEMP_FAILURE_RETRY(lstat(file_1, &file_1_info)) == -1 || |
| 295 TEMP_FAILURE_RETRY(lstat(file_2, &file_2_info)) == -1) { |
| 296 return File::kError; |
| 297 } |
| 298 return (file_1_info.st_ino == file_2_info.st_ino && |
| 299 file_1_info.st_dev == file_2_info.st_dev) ? |
| 300 File::kIdentical : |
| 301 File::kDifferent; |
| 302 } |
| 303 |
| 290 #endif // defined(TARGET_OS_ANDROID) | 304 #endif // defined(TARGET_OS_ANDROID) |
| OLD | NEW |