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

Side by Side Diff: base/file_util_win.cc

Issue 500075: Fix a regression introduced by r33225.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years 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_unittest.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) 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 <propvarutil.h> 8 #include <propvarutil.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #include <shlobj.h> 10 #include <shlobj.h>
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 LOG(WARNING) << "CreateDirectory(" << full_path_str << "), " << 521 LOG(WARNING) << "CreateDirectory(" << full_path_str << "), " <<
522 "conflicts with existing file."; 522 "conflicts with existing file.";
523 } 523 }
524 } 524 }
525 525
526 // Invariant: Path does not exist as file or directory. 526 // Invariant: Path does not exist as file or directory.
527 527
528 // Attempt to create the parent recursively. This will immediately return 528 // Attempt to create the parent recursively. This will immediately return
529 // true if it already exists, otherwise will create all required parent 529 // true if it already exists, otherwise will create all required parent
530 // directories starting with the highest-level missing parent. 530 // directories starting with the highest-level missing parent.
531 if (!CreateDirectory(full_path.DirName())) { 531 FilePath parent_path(full_path.DirName());
532 if (parent_path.value() == full_path.value()) {
533 return false;
534 }
535 if (!CreateDirectory(parent_path)) {
532 DLOG(WARNING) << "Failed to create one of the parent directories."; 536 DLOG(WARNING) << "Failed to create one of the parent directories.";
533 return false; 537 return false;
534 } 538 }
535 539
536 if (!::CreateDirectory(full_path_str, NULL)) { 540 if (!::CreateDirectory(full_path_str, NULL)) {
537 DWORD error_code = ::GetLastError(); 541 DWORD error_code = ::GetLastError();
538 if (error_code == ERROR_ALREADY_EXISTS && DirectoryExists(full_path)) { 542 if (error_code == ERROR_ALREADY_EXISTS && DirectoryExists(full_path)) {
539 // This error code doesn't indicate whether we were racing with someone 543 // This error code doesn't indicate whether we were racing with someone
540 // creating the same directory, or a file with the same path, therefore 544 // creating the same directory, or a file with the same path, therefore
541 // we check. 545 // we check.
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 } 839 }
836 840
837 bool HasFileBeenModifiedSince(const FileEnumerator::FindInfo& find_info, 841 bool HasFileBeenModifiedSince(const FileEnumerator::FindInfo& find_info,
838 const base::Time& cutoff_time) { 842 const base::Time& cutoff_time) {
839 long result = CompareFileTime(&find_info.ftLastWriteTime, 843 long result = CompareFileTime(&find_info.ftLastWriteTime,
840 &cutoff_time.ToFileTime()); 844 &cutoff_time.ToFileTime());
841 return result == 1 || result == 0; 845 return result == 1 || result == 0;
842 } 846 }
843 847
844 } // namespace file_util 848 } // namespace file_util
OLDNEW
« no previous file with comments | « base/file_util_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698