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

Side by Side Diff: base/platform_file_win.cc

Issue 22929021: Converge file_util::GetFileInfo and base::GetPlaformFileInfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nacl? Created 7 years, 4 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
« base/platform_file_posix.cc ('K') | « base/platform_file_posix.cc ('k') | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <io.h> 7 #include <io.h>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 return false; 246 return false;
247 247
248 BY_HANDLE_FILE_INFORMATION file_info; 248 BY_HANDLE_FILE_INFORMATION file_info;
249 if (GetFileInformationByHandle(file, &file_info) == 0) 249 if (GetFileInformationByHandle(file, &file_info) == 0)
250 return false; 250 return false;
251 251
252 LARGE_INTEGER size; 252 LARGE_INTEGER size;
253 size.HighPart = file_info.nFileSizeHigh; 253 size.HighPart = file_info.nFileSizeHigh;
254 size.LowPart = file_info.nFileSizeLow; 254 size.LowPart = file_info.nFileSizeLow;
255 info->size = size.QuadPart; 255 info->size = size.QuadPart;
256
256 info->is_directory = 257 info->is_directory =
257 (file_info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0; 258 (file_info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
259
260 // TODO(gavinp): What about reparse points?
258 info->is_symbolic_link = false; // Windows doesn't have symbolic links. 261 info->is_symbolic_link = false; // Windows doesn't have symbolic links.
262
259 info->last_modified = base::Time::FromFileTime(file_info.ftLastWriteTime); 263 info->last_modified = base::Time::FromFileTime(file_info.ftLastWriteTime);
260 info->last_accessed = base::Time::FromFileTime(file_info.ftLastAccessTime); 264 info->last_accessed = base::Time::FromFileTime(file_info.ftLastAccessTime);
261 info->creation_time = base::Time::FromFileTime(file_info.ftCreationTime); 265 info->creation_time = base::Time::FromFileTime(file_info.ftCreationTime);
262 return true; 266 return true;
263 } 267 }
264 268
265 PlatformFileError LastErrorToPlatformFileError(DWORD last_error) { 269 PlatformFileError LastErrorToPlatformFileError(DWORD last_error) {
266 switch (last_error) { 270 switch (last_error) {
267 case ERROR_SHARING_VIOLATION: 271 case ERROR_SHARING_VIOLATION:
268 return PLATFORM_FILE_ERROR_IN_USE; 272 return PLATFORM_FILE_ERROR_IN_USE;
(...skipping 23 matching lines...) Expand all
292 case ERROR_DISK_CORRUPT: 296 case ERROR_DISK_CORRUPT:
293 return PLATFORM_FILE_ERROR_IO; 297 return PLATFORM_FILE_ERROR_IO;
294 default: 298 default:
295 UMA_HISTOGRAM_SPARSE_SLOWLY("PlatformFile.UnknownErrors.Windows", 299 UMA_HISTOGRAM_SPARSE_SLOWLY("PlatformFile.UnknownErrors.Windows",
296 last_error); 300 last_error);
297 return PLATFORM_FILE_ERROR_FAILED; 301 return PLATFORM_FILE_ERROR_FAILED;
298 } 302 }
299 } 303 }
300 304
301 } // namespace base 305 } // namespace base
OLDNEW
« base/platform_file_posix.cc ('K') | « base/platform_file_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698