summaryrefslogtreecommitdiffstats
path: root/base/file_util_win.cc
diff options
context:
space:
mode:
Diffstat (limited to 'base/file_util_win.cc')
-rw-r--r--base/file_util_win.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/base/file_util_win.cc b/base/file_util_win.cc
index f5e39fa..f2822d1 100644
--- a/base/file_util_win.cc
+++ b/base/file_util_win.cc
@@ -176,6 +176,13 @@ bool PathIsWritable(const std::wstring& path) {
return true;
}
+bool DirectoryExists(const std::wstring& path) {
+ DWORD fileattr = GetFileAttributes(path.c_str());
+ if (fileattr != INVALID_FILE_ATTRIBUTES)
+ return (fileattr & FILE_ATTRIBUTE_DIRECTORY) != 0;
+ return false;
+}
+
bool GetFileCreationLocalTimeFromHandle(HANDLE file_handle,
LPSYSTEMTIME creation_time) {
if (!file_handle)
@@ -419,7 +426,7 @@ bool CreateNewTempDirectory(const std::wstring& prefix,
}
bool CreateDirectory(const std::wstring& full_path) {
- if (PathExists(full_path))
+ if (DirectoryExists(full_path))
return true;
int err = SHCreateDirectoryEx(NULL, full_path.c_str(), NULL);
return err == ERROR_SUCCESS;