| 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 } else { | 289 } else { |
| 290 stat_success = TEMP_FAILURE_RETRY(lstat(pathname, &entry_info)); | 290 stat_success = TEMP_FAILURE_RETRY(lstat(pathname, &entry_info)); |
| 291 } | 291 } |
| 292 if (stat_success == -1) return File::kDoesNotExist; | 292 if (stat_success == -1) return File::kDoesNotExist; |
| 293 if (S_ISDIR(entry_info.st_mode)) return File::kIsDirectory; | 293 if (S_ISDIR(entry_info.st_mode)) return File::kIsDirectory; |
| 294 if (S_ISREG(entry_info.st_mode)) return File::kIsFile; | 294 if (S_ISREG(entry_info.st_mode)) return File::kIsFile; |
| 295 if (S_ISLNK(entry_info.st_mode)) return File::kIsLink; | 295 if (S_ISLNK(entry_info.st_mode)) return File::kIsLink; |
| 296 return File::kDoesNotExist; | 296 return File::kDoesNotExist; |
| 297 } | 297 } |
| 298 | 298 |
| 299 |
| 300 File::Identical File::AreIdentical(const char* file_1, const char* file_2) { |
| 301 struct stat file_1_info; |
| 302 struct stat file_2_info; |
| 303 if (TEMP_FAILURE_RETRY(lstat(file_1, &file_1_info)) == -1 || |
| 304 TEMP_FAILURE_RETRY(lstat(file_2, &file_2_info)) == -1) { |
| 305 return File::kError; |
| 306 } |
| 307 return (file_1_info.st_ino == file_2_info.st_ino && |
| 308 file_1_info.st_dev == file_2_info.st_dev) ? |
| 309 File::kIdentical : |
| 310 File::kDifferent; |
| 311 } |
| 312 |
| 299 #endif // defined(TARGET_OS_MACOS) | 313 #endif // defined(TARGET_OS_MACOS) |
| OLD | NEW |