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

Side by Side Diff: base/files/file_util_win.cc

Issue 1356743003: Revert of Check for CloseHandle failures even when not debugging (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « no previous file | base/memory/shared_memory_win.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) 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/files/file_util.h" 5 #include "base/files/file_util.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <io.h> 8 #include <io.h>
9 #include <psapi.h> 9 #include <psapi.h>
10 #include <shellapi.h> 10 #include <shellapi.h>
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 return success; 224 return success;
225 } 225 }
226 226
227 bool PathExists(const FilePath& path) { 227 bool PathExists(const FilePath& path) {
228 ThreadRestrictions::AssertIOAllowed(); 228 ThreadRestrictions::AssertIOAllowed();
229 return (GetFileAttributes(path.value().c_str()) != INVALID_FILE_ATTRIBUTES); 229 return (GetFileAttributes(path.value().c_str()) != INVALID_FILE_ATTRIBUTES);
230 } 230 }
231 231
232 bool PathIsWritable(const FilePath& path) { 232 bool PathIsWritable(const FilePath& path) {
233 ThreadRestrictions::AssertIOAllowed(); 233 ThreadRestrictions::AssertIOAllowed();
234 win::ScopedHandle dir( 234 HANDLE dir =
235 CreateFile(path.value().c_str(), FILE_ADD_FILE, kFileShareAll, 235 CreateFile(path.value().c_str(), FILE_ADD_FILE, kFileShareAll,
236 NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL)); 236 NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
237 237
238 return dir.IsValid(); 238 if (dir == INVALID_HANDLE_VALUE)
239 return false;
240
241 CloseHandle(dir);
242 return true;
239 } 243 }
240 244
241 bool DirectoryExists(const FilePath& path) { 245 bool DirectoryExists(const FilePath& path) {
242 ThreadRestrictions::AssertIOAllowed(); 246 ThreadRestrictions::AssertIOAllowed();
243 DWORD fileattr = GetFileAttributes(path.value().c_str()); 247 DWORD fileattr = GetFileAttributes(path.value().c_str());
244 if (fileattr != INVALID_FILE_ATTRIBUTES) 248 if (fileattr != INVALID_FILE_ATTRIBUTES)
245 return (fileattr & FILE_ATTRIBUTE_DIRECTORY) != 0; 249 return (fileattr & FILE_ATTRIBUTE_DIRECTORY) != 0;
246 return false; 250 return false;
247 } 251 }
248 252
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 // Like Move, this function is not transactional, so we just 801 // Like Move, this function is not transactional, so we just
798 // leave the copied bits behind if deleting from_path fails. 802 // leave the copied bits behind if deleting from_path fails.
799 // If to_path exists previously then we have already overwritten 803 // If to_path exists previously then we have already overwritten
800 // it by now, we don't get better off by deleting the new bits. 804 // it by now, we don't get better off by deleting the new bits.
801 } 805 }
802 return false; 806 return false;
803 } 807 }
804 808
805 } // namespace internal 809 } // namespace internal
806 } // namespace base 810 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/memory/shared_memory_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698