| 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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 // target. The link might have changed before the readlink call. | 333 // target. The link might have changed before the readlink call. |
| 334 const int kBufferSize = 1024; | 334 const int kBufferSize = 1024; |
| 335 char target[kBufferSize]; | 335 char target[kBufferSize]; |
| 336 size_t target_size = TEMP_FAILURE_RETRY( | 336 size_t target_size = TEMP_FAILURE_RETRY( |
| 337 readlink(pathname, target, kBufferSize)); | 337 readlink(pathname, target, kBufferSize)); |
| 338 if (target_size <= 0) { | 338 if (target_size <= 0) { |
| 339 return NULL; | 339 return NULL; |
| 340 } | 340 } |
| 341 char* target_name = reinterpret_cast<char*>(malloc(target_size + 1)); | 341 char* target_name = reinterpret_cast<char*>(malloc(target_size + 1)); |
| 342 if (target_name == NULL) { | 342 if (target_name == NULL) { |
| 343 return NULL | 343 return NULL; |
| 344 } | 344 } |
| 345 memmove(target_name, target, target_size); | 345 memmove(target_name, target, target_size); |
| 346 target_name[target_size] = '\0'; | 346 target_name[target_size] = '\0'; |
| 347 return target_name; | 347 return target_name; |
| 348 } | 348 } |
| 349 | 349 |
| 350 | 350 |
| 351 bool File::IsAbsolutePath(const char* pathname) { | 351 bool File::IsAbsolutePath(const char* pathname) { |
| 352 return (pathname != NULL && pathname[0] == '/'); | 352 return (pathname != NULL && pathname[0] == '/'); |
| 353 } | 353 } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 return (file_1_info.st_ino == file_2_info.st_ino && | 425 return (file_1_info.st_ino == file_2_info.st_ino && |
| 426 file_1_info.st_dev == file_2_info.st_dev) ? | 426 file_1_info.st_dev == file_2_info.st_dev) ? |
| 427 File::kIdentical : | 427 File::kIdentical : |
| 428 File::kDifferent; | 428 File::kDifferent; |
| 429 } | 429 } |
| 430 | 430 |
| 431 } // namespace bin | 431 } // namespace bin |
| 432 } // namespace dart | 432 } // namespace dart |
| 433 | 433 |
| 434 #endif // defined(TARGET_OS_MACOS) | 434 #endif // defined(TARGET_OS_MACOS) |
| OLD | NEW |