diff options
author | skerner@google.com <skerner@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-05 18:42:17 +0000 |
---|---|---|
committer | skerner@google.com <skerner@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-05 18:42:17 +0000 |
commit | 3bb715ac55d8d5fda1a4f89d22a9d2a663e317e6 (patch) | |
tree | 994062af6428608bb59e7ab7579103421c1b5975 /base | |
parent | b6ee69d9a8b4dfbfabc102eb34b6f2b78b79fffe (diff) | |
download | chromium_src-3bb715ac55d8d5fda1a4f89d22a9d2a663e317e6.zip chromium_src-3bb715ac55d8d5fda1a4f89d22a9d2a663e317e6.tar.gz chromium_src-3bb715ac55d8d5fda1a4f89d22a9d2a663e317e6.tar.bz2 |
Add logging to undersand exactly where CreateDirectory() is failing for users.
BUG=35198
TEST=none
Review URL: http://codereview.chromium.org/1948005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46468 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/file_util_win.cc | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/base/file_util_win.cc b/base/file_util_win.cc index 445f82e..8d502e7 100644 --- a/base/file_util_win.cc +++ b/base/file_util_win.cc @@ -539,13 +539,17 @@ bool CreateNewTempDirectory(const FilePath::StringType& prefix, return CreateTemporaryDirInDir(system_temp_dir, prefix, new_temp_path); } +// TODO(skerner): Extra logging has been added to understand crbug/35198 . +// Remove it once we get a log from a user who can reproduce the issue. bool CreateDirectory(const FilePath& full_path) { + LOG(INFO) << "Enter CreateDirectory: full_path = " << full_path.value(); // If the path exists, we've succeeded if it's a directory, failed otherwise. const wchar_t* full_path_str = full_path.value().c_str(); DWORD fileattr = ::GetFileAttributes(full_path_str); + LOG(INFO) << "::GetFileAttributes() returned " << fileattr; if (fileattr != INVALID_FILE_ATTRIBUTES) { if ((fileattr & FILE_ATTRIBUTE_DIRECTORY) != 0) { - DLOG(INFO) << "CreateDirectory(" << full_path_str << "), " << + LOG(INFO) << "CreateDirectory(" << full_path_str << "), " << "directory already exists."; return true; } else { @@ -561,19 +565,27 @@ bool CreateDirectory(const FilePath& full_path) { // directories starting with the highest-level missing parent. FilePath parent_path(full_path.DirName()); if (parent_path.value() == full_path.value()) { + LOG(INFO) << "Can't create directory: parent_path " << + parent_path.value() << " should not equal full_path " << + full_path.value(); return false; } if (!CreateDirectory(parent_path)) { - DLOG(WARNING) << "Failed to create one of the parent directories."; + LOG(INFO) << "Failed to create one of the parent directories: " << + parent_path.value(); return false; } + LOG(INFO) << "About to call ::CreateDirectory() with full_path_str = " << + full_path_str; if (!::CreateDirectory(full_path_str, NULL)) { DWORD error_code = ::GetLastError(); if (error_code == ERROR_ALREADY_EXISTS && DirectoryExists(full_path)) { // This error code doesn't indicate whether we were racing with someone // creating the same directory, or a file with the same path, therefore // we check. + LOG(INFO) << "Race condition? Directory already exists: " << + full_path.value(); return true; } else { LOG(WARNING) << "Failed to create directory " << full_path_str << @@ -581,6 +593,7 @@ bool CreateDirectory(const FilePath& full_path) { return false; } } else { + LOG(INFO) << "::CreateDirectory() worked."; return true; } } |