Index: base/file_util_win.cc |
diff --git a/base/file_util_win.cc b/base/file_util_win.cc |
index 9265ce23fc600b30826773a4937d5b6ce1e08621..32b6811514c10aa9c66284bc6d6546b439d2b8ac 100644 |
--- a/base/file_util_win.cc |
+++ b/base/file_util_win.cc |
@@ -1,4 +1,4 @@ |
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
@@ -589,6 +589,16 @@ bool GetFileInfo(const FilePath& file_path, FileInfo* results) { |
return true; |
} |
+bool SetLastModifiedTime(const FilePath& file_path, base::Time last_modified) { |
+ FILETIME timestamp(last_modified.ToFileTime()); |
+ ScopedHandle file_handle( |
+ CreateFile(file_path.value().c_str(), FILE_WRITE_ATTRIBUTES, |
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, |
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)); |
+ BOOL ret = SetFileTime(file_handle.Get(), NULL, ×tamp, ×tamp); |
+ return ret != 0; |
+} |
+ |
FILE* OpenFile(const FilePath& filename, const char* mode) { |
std::wstring w_mode = ASCIIToWide(std::string(mode)); |
FILE* file; |