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

Side by Side Diff: base/platform_file_posix.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/file_util_win.cc ('k') | base/platform_file_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/platform_file.h" 5 #include "base/platform_file.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 !(flags & PLATFORM_FILE_OPEN_ALWAYS)) { 45 !(flags & PLATFORM_FILE_OPEN_ALWAYS)) {
46 NOTREACHED(); 46 NOTREACHED();
47 errno = EOPNOTSUPP; 47 errno = EOPNOTSUPP;
48 if (error_code) 48 if (error_code)
49 *error_code = PLATFORM_FILE_ERROR_FAILED; 49 *error_code = PLATFORM_FILE_ERROR_FAILED;
50 return kInvalidPlatformFileValue; 50 return kInvalidPlatformFileValue;
51 } 51 }
52 52
53 if (flags & PLATFORM_FILE_WRITE && flags & PLATFORM_FILE_READ) { 53 if (flags & PLATFORM_FILE_WRITE && flags & PLATFORM_FILE_READ) {
54 open_flags |= O_RDWR; 54 open_flags |= O_RDWR;
55 } else if (flags & PLATFORM_FILE_WRITE) { 55 } else if (flags & PLATFORM_FILE_WRITE ||
56 flags & PLATFORM_FILE_WRITE_ATTRIBUTES) {
56 open_flags |= O_WRONLY; 57 open_flags |= O_WRONLY;
57 } else if (!(flags & PLATFORM_FILE_READ)) { 58 } else if (!(flags & PLATFORM_FILE_READ)) {
58 NOTREACHED(); 59 NOTREACHED();
59 } 60 }
60 61
61 if (flags & PLATFORM_FILE_TRUNCATE) { 62 if (flags & PLATFORM_FILE_TRUNCATE) {
62 DCHECK(flags & PLATFORM_FILE_WRITE); 63 DCHECK(flags & PLATFORM_FILE_WRITE);
63 open_flags |= O_TRUNC; 64 open_flags |= O_TRUNC;
64 } 65 }
65 66
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 186
186 info->is_directory = S_ISDIR(file_info.st_mode); 187 info->is_directory = S_ISDIR(file_info.st_mode);
187 info->size = file_info.st_size; 188 info->size = file_info.st_size;
188 info->last_modified = base::Time::FromTimeT(file_info.st_mtime); 189 info->last_modified = base::Time::FromTimeT(file_info.st_mtime);
189 info->last_accessed = base::Time::FromTimeT(file_info.st_atime); 190 info->last_accessed = base::Time::FromTimeT(file_info.st_atime);
190 info->creation_time = base::Time::FromTimeT(file_info.st_ctime); 191 info->creation_time = base::Time::FromTimeT(file_info.st_ctime);
191 return true; 192 return true;
192 } 193 }
193 194
194 } // namespace base 195 } // namespace base
OLDNEW
« no previous file with comments | « base/file_util_win.cc ('k') | base/platform_file_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698