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

Side by Side Diff: base/file_util_win.cc

Issue 6297003: Fail gracefully if profile Temp dir can not be accessed. (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: Address rev comments. Created 9 years, 11 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 | « no previous file | chrome/browser/extensions/convert_user_script.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <psapi.h> 9 #include <psapi.h>
10 #include <shellapi.h> 10 #include <shellapi.h>
11 #include <shlobj.h> 11 #include <shlobj.h>
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 return false; 660 return false;
661 } 661 }
662 if (!CreateDirectory(parent_path)) { 662 if (!CreateDirectory(parent_path)) {
663 DLOG(WARNING) << "Failed to create one of the parent directories."; 663 DLOG(WARNING) << "Failed to create one of the parent directories.";
664 return false; 664 return false;
665 } 665 }
666 666
667 if (!::CreateDirectory(full_path_str, NULL)) { 667 if (!::CreateDirectory(full_path_str, NULL)) {
668 DWORD error_code = ::GetLastError(); 668 DWORD error_code = ::GetLastError();
669 if (error_code == ERROR_ALREADY_EXISTS && DirectoryExists(full_path)) { 669 if (error_code == ERROR_ALREADY_EXISTS && DirectoryExists(full_path)) {
670 // This error code doesn't indicate whether we were racing with someone 670 // This error code ERROR_ALREADY_EXISTS doesn't indicate whether we
671 // creating the same directory, or a file with the same path, therefore 671 // were racing with someone creating the same directory, or a file
672 // we check. 672 // with the same path. If DirectoryExists() returns true, we lost the
673 // race to create the same directory.
673 return true; 674 return true;
674 } else { 675 } else {
675 LOG(WARNING) << "Failed to create directory " << full_path_str 676 LOG(WARNING) << "Failed to create directory " << full_path_str
676 << ", last error is " << error_code << "."; 677 << ", last error is " << error_code << ".";
677 return false; 678 return false;
678 } 679 }
679 } else { 680 } else {
680 return true; 681 return true;
681 } 682 }
682 } 683 }
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 uint8 unused = *(touch + offset); 1119 uint8 unused = *(touch + offset);
1119 offset += step_size; 1120 offset += step_size;
1120 } 1121 }
1121 FreeLibrary(dll_module); 1122 FreeLibrary(dll_module);
1122 } 1123 }
1123 1124
1124 return true; 1125 return true;
1125 } 1126 }
1126 1127
1127 } // namespace file_util 1128 } // namespace file_util
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/convert_user_script.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698