summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
-