| 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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 int stat_success; | 410 int stat_success; |
| 411 if (follow_links) { | 411 if (follow_links) { |
| 412 stat_success = NO_RETRY_EXPECTED(stat(pathname, &entry_info)); | 412 stat_success = NO_RETRY_EXPECTED(stat(pathname, &entry_info)); |
| 413 } else { | 413 } else { |
| 414 stat_success = NO_RETRY_EXPECTED(lstat(pathname, &entry_info)); | 414 stat_success = NO_RETRY_EXPECTED(lstat(pathname, &entry_info)); |
| 415 } | 415 } |
| 416 if (stat_success == -1) return File::kDoesNotExist; | 416 if (stat_success == -1) return File::kDoesNotExist; |
| 417 if (S_ISDIR(entry_info.st_mode)) return File::kIsDirectory; | 417 if (S_ISDIR(entry_info.st_mode)) return File::kIsDirectory; |
| 418 if (S_ISREG(entry_info.st_mode)) return File::kIsFile; | 418 if (S_ISREG(entry_info.st_mode)) return File::kIsFile; |
| 419 if (S_ISLNK(entry_info.st_mode)) return File::kIsLink; | 419 if (S_ISLNK(entry_info.st_mode)) return File::kIsLink; |
| 420 if (S_ISSOCK(entry_info.st_mode)) return File::kIsFile; // HACK. |
| 420 return File::kDoesNotExist; | 421 return File::kDoesNotExist; |
| 421 } | 422 } |
| 422 | 423 |
| 423 | 424 |
| 424 File::Identical File::AreIdentical(const char* file_1, const char* file_2) { | 425 File::Identical File::AreIdentical(const char* file_1, const char* file_2) { |
| 425 struct stat file_1_info; | 426 struct stat file_1_info; |
| 426 struct stat file_2_info; | 427 struct stat file_2_info; |
| 427 if (NO_RETRY_EXPECTED(lstat(file_1, &file_1_info)) == -1 || | 428 if (NO_RETRY_EXPECTED(lstat(file_1, &file_1_info)) == -1 || |
| 428 NO_RETRY_EXPECTED(lstat(file_2, &file_2_info)) == -1) { | 429 NO_RETRY_EXPECTED(lstat(file_2, &file_2_info)) == -1) { |
| 429 return File::kError; | 430 return File::kError; |
| 430 } | 431 } |
| 431 return (file_1_info.st_ino == file_2_info.st_ino && | 432 return (file_1_info.st_ino == file_2_info.st_ino && |
| 432 file_1_info.st_dev == file_2_info.st_dev) ? | 433 file_1_info.st_dev == file_2_info.st_dev) ? |
| 433 File::kIdentical : | 434 File::kIdentical : |
| 434 File::kDifferent; | 435 File::kDifferent; |
| 435 } | 436 } |
| 436 | 437 |
| 437 } // namespace bin | 438 } // namespace bin |
| 438 } // namespace dart | 439 } // namespace dart |
| 439 | 440 |
| 440 #endif // defined(TARGET_OS_MACOS) | 441 #endif // defined(TARGET_OS_MACOS) |
| OLD | NEW |