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

Side by Side Diff: base/file_util_win.cc

Issue 9074: Port more of url_request_unittest.cc.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 1 month 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/file_util.h" 5 #include "base/file_util.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 #include <shlobj.h> 9 #include <shlobj.h>
10 #include <time.h> 10 #include <time.h>
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 return true; 449 return true;
450 } 450 }
451 451
452 bool CreateDirectory(const FilePath& full_path) { 452 bool CreateDirectory(const FilePath& full_path) {
453 if (DirectoryExists(full_path)) 453 if (DirectoryExists(full_path))
454 return true; 454 return true;
455 int err = SHCreateDirectoryEx(NULL, full_path.value().c_str(), NULL); 455 int err = SHCreateDirectoryEx(NULL, full_path.value().c_str(), NULL);
456 return err == ERROR_SUCCESS; 456 return err == ERROR_SUCCESS;
457 } 457 }
458 458
459 bool GetFileInfo(const std::wstring& file_path, FileInfo* results) { 459 bool GetFileInfo(const FilePath& file_path, FileInfo* results) {
460 WIN32_FILE_ATTRIBUTE_DATA attr; 460 WIN32_FILE_ATTRIBUTE_DATA attr;
461 if (!GetFileAttributesEx(file_path.c_str(), GetFileExInfoStandard, &attr)) 461 if (!GetFileAttributesEx(file_path.ToWstringHack().c_str(), GetFileExInfoStand ard, &attr))
462 return false; 462 return false;
463 463
464 ULARGE_INTEGER size; 464 ULARGE_INTEGER size;
465 size.HighPart = attr.nFileSizeHigh; 465 size.HighPart = attr.nFileSizeHigh;
466 size.LowPart = attr.nFileSizeLow; 466 size.LowPart = attr.nFileSizeLow;
467 results->size = size.QuadPart; 467 results->size = size.QuadPart;
468 468
469 results->is_directory = 469 results->is_directory =
470 (attr.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0; 470 (attr.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
471 return true; 471 return true;
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 // it to pending_paths_ so we scan it after we finish scanning this 679 // it to pending_paths_ so we scan it after we finish scanning this
680 // directory. 680 // directory.
681 pending_paths_.push(cur_file); 681 pending_paths_.push(cur_file);
682 } 682 }
683 return (file_type_ & FileEnumerator::DIRECTORIES) ? cur_file : Next(); 683 return (file_type_ & FileEnumerator::DIRECTORIES) ? cur_file : Next();
684 } 684 }
685 return (file_type_ & FileEnumerator::FILES) ? cur_file : Next(); 685 return (file_type_ & FileEnumerator::FILES) ? cur_file : Next();
686 } 686 }
687 687
688 } // namespace file_util 688 } // namespace file_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698