diff options
author | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-18 21:53:00 +0000 |
---|---|---|
committer | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-18 21:53:00 +0000 |
commit | 89fb65a6f0f1b6981c26c9b9d05a02332f6ec6d7 (patch) | |
tree | 5a468222857cf411fec486a7a806a333f4e6cfc2 /base/file_util_win.cc | |
parent | 21605478c7a32298c06c29d3f8f59ed42b90c091 (diff) | |
download | chromium_src-89fb65a6f0f1b6981c26c9b9d05a02332f6ec6d7.zip chromium_src-89fb65a6f0f1b6981c26c9b9d05a02332f6ec6d7.tar.gz chromium_src-89fb65a6f0f1b6981c26c9b9d05a02332f6ec6d7.tar.bz2 |
** Think this may have caused TabSwitchingTest to fail, as it is parsing log files. **
Revert 62959 - Convert LOG(INFO) to VLOG(1) - base/.
Also removes an "else" after "return" and aligns "<<" per style guide.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3845002
TBR=pkasting@chromium.org
Review URL: http://codereview.chromium.org/3850006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62981 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util_win.cc')
-rw-r--r-- | base/file_util_win.cc | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/base/file_util_win.cc b/base/file_util_win.cc index 30d314f..d9f8404 100644 --- a/base/file_util_win.cc +++ b/base/file_util_win.cc @@ -561,7 +561,8 @@ bool CreateTemporaryDirInDir(const FilePath& base_dir, FilePath path_to_create; srand(static_cast<uint32>(time(NULL))); - for (int count = 0; count < 50; ++count) { + int count = 0; + while (count < 50) { // Try create a new temporary directory with random generated name. If // the one exists, keep trying another path name until we reach some limit. path_to_create = base_dir; @@ -571,13 +572,17 @@ bool CreateTemporaryDirInDir(const FilePath& base_dir, new_dir_name.append(base::IntToString16(rand() % kint16max)); path_to_create = path_to_create.Append(new_dir_name); - if (::CreateDirectory(path_to_create.value().c_str(), NULL)) { - *new_dir = path_to_create; - return true; - } + if (::CreateDirectory(path_to_create.value().c_str(), NULL)) + break; + count++; } - return false; + if (count == 50) { + return false; + } + + *new_dir = path_to_create; + return true; } bool CreateNewTempDirectory(const FilePath::StringType& prefix, @@ -595,13 +600,14 @@ bool CreateDirectory(const FilePath& full_path) { DWORD fileattr = ::GetFileAttributes(full_path_str); if (fileattr != INVALID_FILE_ATTRIBUTES) { if ((fileattr & FILE_ATTRIBUTE_DIRECTORY) != 0) { - DVLOG(1) << "CreateDirectory(" << full_path_str << "), " - << "directory already exists."; + DLOG(INFO) << "CreateDirectory(" << full_path_str << "), " + << "directory already exists."; return true; + } else { + LOG(WARNING) << "CreateDirectory(" << full_path_str << "), " + << "conflicts with existing file."; + return false; } - LOG(WARNING) << "CreateDirectory(" << full_path_str << "), " - << "conflicts with existing file."; - return false; } // Invariant: Path does not exist as file or directory. |