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

Unified Diff: base/file_util.cc

Issue 101143006: Convert base::file_util to use File instead of PlatformFile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove base:: Created 6 years, 11 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
diff --git a/base/file_util.cc b/base/file_util.cc
index 1575a079d6b781bfd43d4e706176e7c9984db55c..e44f713cdb31828010ad9be92739a3d021dc4685 100644
--- a/base/file_util.cc
+++ b/base/file_util.cc
@@ -166,7 +166,7 @@ bool CreateDirectory(const FilePath& full_path) {
}
bool GetFileSize(const FilePath& file_path, int64* file_size) {
- PlatformFileInfo info;
+ File::Info info;
if (!GetFileInfo(file_path, &info))
return false;
*file_size = info.size;
@@ -176,22 +176,19 @@ bool GetFileSize(const FilePath& file_path, int64* file_size) {
bool TouchFile(const FilePath& path,
const Time& last_accessed,
const Time& last_modified) {
- int flags = PLATFORM_FILE_OPEN | PLATFORM_FILE_WRITE_ATTRIBUTES;
+ int flags = File::FLAG_OPEN | File::FLAG_WRITE_ATTRIBUTES;
#if defined(OS_WIN)
// On Windows, FILE_FLAG_BACKUP_SEMANTICS is needed to open a directory.
if (DirectoryExists(path))
- flags |= PLATFORM_FILE_BACKUP_SEMANTICS;
+ flags |= File::FLAG_BACKUP_SEMANTICS;
#endif // OS_WIN
- const PlatformFile file = CreatePlatformFile(path, flags, NULL, NULL);
- if (file != kInvalidPlatformFileValue) {
- bool result = TouchPlatformFile(file, last_accessed, last_modified);
- ClosePlatformFile(file);
- return result;
- }
+ File file(path, flags);
+ if (!file.IsValid())
+ return false;
- return false;
+ return file.SetTimes(last_accessed, last_modified);
}
bool CloseFile(FILE* file) {
« 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