Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1289)

Unified Diff: runtime/bin/file_macos.cc

Issue 12850010: Add FileSystemEntity.identical, to test if two file system objects are the same. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Change argument names from file1, file2 to path1, path2. Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/file_linux.cc ('k') | runtime/bin/file_system_entity_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/file_macos.cc
diff --git a/runtime/bin/file_macos.cc b/runtime/bin/file_macos.cc
index 67869e3124591f27a0d97f9bbd5dbf7b9177552d..301424b3daface22b3ad7cb6927934d3308de97c 100644
--- a/runtime/bin/file_macos.cc
+++ b/runtime/bin/file_macos.cc
@@ -296,4 +296,18 @@ File::Type File::GetType(const char* pathname, bool follow_links) {
return File::kDoesNotExist;
}
+
+File::Identical File::AreIdentical(const char* file_1, const char* file_2) {
+ struct stat file_1_info;
+ struct stat file_2_info;
+ if (TEMP_FAILURE_RETRY(lstat(file_1, &file_1_info)) == -1 ||
+ TEMP_FAILURE_RETRY(lstat(file_2, &file_2_info)) == -1) {
+ return File::kError;
+ }
+ return (file_1_info.st_ino == file_2_info.st_ino &&
+ file_1_info.st_dev == file_2_info.st_dev) ?
+ File::kIdentical :
+ File::kDifferent;
+}
+
#endif // defined(TARGET_OS_MACOS)
« no previous file with comments | « runtime/bin/file_linux.cc ('k') | runtime/bin/file_system_entity_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698