OLD | NEW |
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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 break; | 127 break; |
128 default: | 128 default: |
129 *error_code = PLATFORM_FILE_ERROR_FAILED; | 129 *error_code = PLATFORM_FILE_ERROR_FAILED; |
130 } | 130 } |
131 } | 131 } |
132 } | 132 } |
133 | 133 |
134 return descriptor; | 134 return descriptor; |
135 } | 135 } |
136 | 136 |
137 PlatformFile CreatePlatformFile(const std::wstring& name, int flags, | |
138 bool* created) { | |
139 return CreatePlatformFile(FilePath::FromWStringHack(name), flags, | |
140 created, NULL); | |
141 } | |
142 | |
143 bool ClosePlatformFile(PlatformFile file) { | 137 bool ClosePlatformFile(PlatformFile file) { |
144 return !close(file); | 138 return !close(file); |
145 } | 139 } |
146 | 140 |
147 int ReadPlatformFile(PlatformFile file, int64 offset, char* data, int size) { | 141 int ReadPlatformFile(PlatformFile file, int64 offset, char* data, int size) { |
148 if (file < 0) | 142 if (file < 0) |
149 return -1; | 143 return -1; |
150 | 144 |
151 return HANDLE_EINTR(pread(file, data, size, offset)); | 145 return HANDLE_EINTR(pread(file, data, size, offset)); |
152 } | 146 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 info->is_directory = S_ISDIR(file_info.st_mode); | 183 info->is_directory = S_ISDIR(file_info.st_mode); |
190 info->is_symbolic_link = S_ISLNK(file_info.st_mode); | 184 info->is_symbolic_link = S_ISLNK(file_info.st_mode); |
191 info->size = file_info.st_size; | 185 info->size = file_info.st_size; |
192 info->last_modified = base::Time::FromTimeT(file_info.st_mtime); | 186 info->last_modified = base::Time::FromTimeT(file_info.st_mtime); |
193 info->last_accessed = base::Time::FromTimeT(file_info.st_atime); | 187 info->last_accessed = base::Time::FromTimeT(file_info.st_atime); |
194 info->creation_time = base::Time::FromTimeT(file_info.st_ctime); | 188 info->creation_time = base::Time::FromTimeT(file_info.st_ctime); |
195 return true; | 189 return true; |
196 } | 190 } |
197 | 191 |
198 } // namespace base | 192 } // namespace base |
OLD | NEW |