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

Unified Diff: runtime/bin/file_win.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_win.cc
diff --git a/runtime/bin/file_win.cc b/runtime/bin/file_win.cc
index 4341edcc3a1a1bad1f05a48d6235dc3093ffe617..31620032bfd19d98f3108aff276c04daeb0d25d5 100644
--- a/runtime/bin/file_win.cc
+++ b/runtime/bin/file_win.cc
@@ -391,6 +391,31 @@ char* File::LinkTarget(const char* pathname) {
}
+void File::Stat(const char* name, int64_t* data) {
+ File::Type type = GetType(name, false);
+ data[kType] = type;
+ data[kCreatedTime] = 0;
+ data[kModifiedTime] = 0;
+ data[kAccessedTime] = 0;
+ data[kMode] = 0;
+ data[kSize] = 0;
+ if (type != kDoesNotExist) {
+ struct _stat64 st;
+ const wchar_t* system_name = StringUtils::Utf8ToWide(name);
+ int stat_status = _wstat64(system_name, &st);
+ if (stat_status == 0) {
+ 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] = File::kDoesNotExist;
+ }
+ }
+}
+
+
time_t File::LastModified(const char* name) {
struct _stat st;
const wchar_t* system_name = StringUtils::Utf8ToWide(name);

Powered by Google App Engine
This is Rietveld 408576698