summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authormmoss@google.com <mmoss@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-09 22:35:16 +0000
committermmoss@google.com <mmoss@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-09 22:35:16 +0000
commit81569624c8daa060aaab5894df4f834e102c5c95 (patch)
tree297fb29de8018b98a53590f20c491868187ebe69 /base
parentf9987b49140ea45f9f597e67dd85c2428a8cb242 (diff)
downloadchromium_src-81569624c8daa060aaab5894df4f834e102c5c95.zip
chromium_src-81569624c8daa060aaab5894df4f834e102c5c95.tar.gz
chromium_src-81569624c8daa060aaab5894df4f834e102c5c95.tar.bz2
Make CreateDirectory consistent on Win and Posix when directory exists.
Review URL: http://codereview.chromium.org/1681 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1941 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/file_util.h4
-rw-r--r--base/file_util_win.cc3
2 files changed, 4 insertions, 3 deletions
diff --git a/base/file_util.h b/base/file_util.h
index af8ac90..304d3cb 100644
--- a/base/file_util.h
+++ b/base/file_util.h
@@ -222,7 +222,8 @@ bool CreateNewTempDirectory(const std::wstring& prefix,
std::wstring* new_temp_path);
// Creates a directory, as well as creating any parent directories, if they
-// don't exist. Returns 'true' on successful creation.
+// don't exist. Returns 'true' on successful creation, or if the directory
+// already exists.
bool CreateDirectory(const std::wstring& full_path);
// Returns the file size. Returns true on success.
@@ -320,4 +321,3 @@ bool RenameFileAndResetSecurityDescriptor(
} // namespace file_util
#endif // BASE_FILE_UTIL_H_
-
diff --git a/base/file_util_win.cc b/base/file_util_win.cc
index 9c9a4e4..f5e39fa 100644
--- a/base/file_util_win.cc
+++ b/base/file_util_win.cc
@@ -419,6 +419,8 @@ bool CreateNewTempDirectory(const std::wstring& prefix,
}
bool CreateDirectory(const std::wstring& full_path) {
+ if (PathExists(full_path))
+ return true;
int err = SHCreateDirectoryEx(NULL, full_path.c_str(), NULL);
return err == ERROR_SUCCESS;
}
@@ -643,4 +645,3 @@ std::wstring FileEnumerator::Next() {
}
} // namespace file_util
-