Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2850)

Unified Diff: base/file_util_posix.cc

Issue 1709: CreateDirectory() should check if an existing path is actually a directory... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/file_util.h ('k') | base/file_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util_posix.cc
===================================================================
--- base/file_util_posix.cc (revision 2057)
+++ base/file_util_posix.cc (working copy)
@@ -111,6 +111,13 @@
return (stat64(WideToUTF8(path).c_str(), &file_info) == 0);
}
+bool DirectoryExists(const std::wstring& path) {
+ struct stat64 file_info;
+ if (stat64(WideToUTF8(path).c_str(), &file_info) == 0)
+ return S_ISDIR(file_info.st_mode);
+ return false;
+}
+
// TODO(erikkay): implement
#if 0
bool GetFileCreationLocalTimeFromHandle(int fd,
@@ -179,7 +186,7 @@
path = *i;
else
AppendToPath(&path, *i);
- if (!PathExists(path)) {
+ if (!DirectoryExists(path)) {
if (mkdir(WideToUTF8(path).c_str(), 0777) != 0)
return false;
}
@@ -324,5 +331,3 @@
} // namespace file_util
-
-
« no previous file with comments | « base/file_util.h ('k') | base/file_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698