summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/file_util.h4
-rw-r--r--base/file_util_posix.cc1
-rw-r--r--base/file_util_win.cc2
3 files changed, 7 insertions, 0 deletions
diff --git a/base/file_util.h b/base/file_util.h
index 35b9dd5..9e2636e7 100644
--- a/base/file_util.h
+++ b/base/file_util.h
@@ -29,6 +29,7 @@
#include "base/file_path.h"
#include "base/scoped_ptr.h"
#include "base/string16.h"
+#include "base/time.h"
namespace base {
class Time;
@@ -337,6 +338,9 @@ struct FileInfo {
// True if the file corresponds to a directory.
bool is_directory;
+ // The last modified time of a file.
+ base::Time last_modified;
+
// Add additional fields here as needed.
};
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index 58454cf..6642eaa 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -525,6 +525,7 @@ bool GetFileInfo(const FilePath& file_path, FileInfo* results) {
return false;
results->is_directory = S_ISDIR(file_info.st_mode);
results->size = file_info.st_size;
+ results->last_modified = base::Time::FromTimeT(file_info.st_mtime);
return true;
}
diff --git a/base/file_util_win.cc b/base/file_util_win.cc
index 91b9e2b..c83322e 100644
--- a/base/file_util_win.cc
+++ b/base/file_util_win.cc
@@ -547,6 +547,8 @@ bool GetFileInfo(const FilePath& file_path, FileInfo* results) {
results->is_directory =
(attr.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
+ results->last_modified = base::Time::FromFileTime(attr.ftLastWriteTime);
+
return true;
}