| Index: base/files/file_util_win.cc
|
| diff --git a/base/files/file_util_win.cc b/base/files/file_util_win.cc
|
| index 294726a8279089098c812fff6c35738d6dd65660..923514568c350a5af1a4985f5e82232a2820df0f 100644
|
| --- a/base/files/file_util_win.cc
|
| +++ b/base/files/file_util_win.cc
|
| @@ -90,37 +90,58 @@ FilePath MakeAbsoluteFilePath(const FilePath& input) {
|
| }
|
|
|
| bool DeleteFile(const FilePath& path, bool recursive) {
|
| + LOG(WARNING) << "base::DeleteFile: Asserting IO allowed";
|
| ThreadRestrictions::AssertIOAllowed();
|
|
|
| - if (path.empty())
|
| + LOG(WARNING) << "base::DeleteFile: IO allowed assertion is OK";
|
| + if (path.empty()) {
|
| + LOG(WARNING) << "base::DeleteFile: Succeeded (path was empty)";
|
| return true;
|
| + }
|
|
|
| - if (path.value().length() >= MAX_PATH)
|
| + if (path.value().length() >= MAX_PATH) {
|
| + LOG(WARNING) << "base::DeleteFile: Failed (path was too long)";
|
| return false;
|
| + }
|
|
|
| // Handle any path with wildcards.
|
| if (path.BaseName().value().find_first_of(L"*?") !=
|
| FilePath::StringType::npos) {
|
| - return DeleteFileRecursive(path.DirName(), path.BaseName().value(),
|
| - recursive);
|
| + bool r =
|
| + DeleteFileRecursive(path.DirName(), path.BaseName().value(), recursive);
|
| + LOG(WARNING) << "base::DeleteFile: " << (r ? "succeeded" : "failed")
|
| + << " due to DeleteFileRecursive.";
|
| + return r;
|
| }
|
| DWORD attr = GetFileAttributes(path.value().c_str());
|
| // We're done if we can't find the path.
|
| - if (attr == INVALID_FILE_ATTRIBUTES)
|
| + if (attr == INVALID_FILE_ATTRIBUTES) {
|
| + LOG(WARNING) << "base::DeleteFile: Succeeded because doesn't exist.";
|
| return true;
|
| + }
|
| // We may need to clear the read-only bit.
|
| if ((attr & FILE_ATTRIBUTE_READONLY) &&
|
| !SetFileAttributes(path.value().c_str(),
|
| attr & ~FILE_ATTRIBUTE_READONLY)) {
|
| + LOG(WARNING) << "base::DeleteFile: Failed because read only.";
|
| return false;
|
| }
|
| // Directories are handled differently if they're recursive.
|
| - if (!(attr & FILE_ATTRIBUTE_DIRECTORY))
|
| - return !!::DeleteFile(path.value().c_str());
|
| + if (!(attr & FILE_ATTRIBUTE_DIRECTORY)) {
|
| + bool r = !!::DeleteFile(path.value().c_str());
|
| + LOG(WARNING) << "base::DeleteFile: " << (r ? "succeeded" : "failed")
|
| + << " due to ::DeleteFile.";
|
| + return r;
|
| + }
|
| // Handle a simple, single file delete.
|
| - if (!recursive || DeleteFileRecursive(path, L"*", true))
|
| - return !!RemoveDirectory(path.value().c_str());
|
| + if (!recursive || DeleteFileRecursive(path, L"*", true)) {
|
| + bool r = !!RemoveDirectory(path.value().c_str());
|
| + LOG(WARNING) << "base::DeleteFile: " << (r ? "succeeded" : "failed")
|
| + << " due to RemoveDirectory.";
|
| + return r;
|
| + }
|
|
|
| + LOG(WARNING) << "base::DeleteFile: Failed because ???.";
|
| return false;
|
| }
|
|
|
|
|