Index: runtime/bin/file_macos.cc |
diff --git a/runtime/bin/file_macos.cc b/runtime/bin/file_macos.cc |
index 0b99153dc3b3e29fe76ba1e25e19733d42698485..c693f949bc2a1a8810aadd177dc42b0a5fc9b428 100644 |
--- a/runtime/bin/file_macos.cc |
+++ b/runtime/bin/file_macos.cc |
@@ -204,6 +204,34 @@ off_t File::LengthFromPath(const char* name) { |
} |
+void File::Stat(const char* name, int64_t* data) { |
+ struct stat st; |
+ if (TEMP_FAILURE_RETRY(stat(name, &st)) == 0) { |
+ if (S_ISREG(st.st_mode)) { |
+ data[kType] = kIsFile; |
+ } else if (S_ISDIR(st.st_mode)) { |
+ data[kType] = kIsDirectory; |
+ } else if (S_ISLNK(st.st_mode)) { |
+ data[kType] = kIsLink; |
+ } else { |
+ data[kType] = kDoesNotExist; |
+ } |
+ data[kCreatedTime] = st.st_ctime; |
+ data[kModifiedTime] = st.st_mtime; |
+ data[kAccessedTime] = st.st_atime; |
+ data[kMode] = st.st_mode; |
+ data[kSize] = st.st_size; |
+ } else { |
+ data[kType] = kDoesNotExist; |
+ data[kCreatedTime] = 0; |
+ data[kModifiedTime] = 0; |
+ data[kAccessedTime] = 0; |
+ data[kMode] = 0; |
+ data[kSize] = 0; |
+ } |
+} |
+ |
+ |
time_t File::LastModified(const char* name) { |
struct stat st; |
if (TEMP_FAILURE_RETRY(stat(name, &st)) == 0) { |