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

Unified Diff: base/file_util.cc

Issue 3404018: Add a TouchFile function that operates on FilePaths + fixing a bug... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 3 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
« no previous file with comments | « base/file_util.h ('k') | base/file_util_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util.cc
===================================================================
--- base/file_util.cc (revision 60236)
+++ base/file_util.cc (working copy)
@@ -200,6 +200,28 @@
return FILE_PATH_LITERAL("..") == path.BaseName().value();
}
+bool TouchFile(const FilePath& path,
+ const base::Time& last_accessed,
+ const base::Time& last_modified) {
+ base::PlatformFile file =
+ base::CreatePlatformFile(path,
+ base::PLATFORM_FILE_OPEN |
+ base::PLATFORM_FILE_WRITE_ATTRIBUTES,
+ NULL, NULL);
+ if (file != base::kInvalidPlatformFileValue) {
+ bool result = base::TouchPlatformFile(file, last_accessed, last_modified);
+ base::ClosePlatformFile(file);
+ return result;
+ }
+
+ return false;
+}
+
+bool SetLastModifiedTime(const FilePath& path,
+ const base::Time& last_modified) {
+ return TouchFile(path, last_modified, last_modified);
+}
+
bool CloseFile(FILE* file) {
if (file == NULL)
return true;
« no previous file with comments | « base/file_util.h ('k') | base/file_util_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698