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

Unified Diff: runtime/bin/file_macos.cc

Issue 15018011: dart:io | Add FileSystemEntity.stat() and FileStat class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix Windows failures. Created 7 years, 7 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
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) {

Powered by Google App Engine
This is Rietveld 408576698