summaryrefslogtreecommitdiffstats
path: root/webkit/fileapi/file_system_file_util.cc
diff options
context:
space:
mode:
authorkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-07 22:57:58 +0000
committerkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-07 22:57:58 +0000
commit3bf73d5ec779ce14a04a00d24d71a038fd954832 (patch)
tree2e004608e064b71f49a3e925b5209076b7a9abf2 /webkit/fileapi/file_system_file_util.cc
parente01e7dc7572fd5e3115ad7624a75a5bc3c99cfac (diff)
downloadchromium_src-3bf73d5ec779ce14a04a00d24d71a038fd954832.zip
chromium_src-3bf73d5ec779ce14a04a00d24d71a038fd954832.tar.gz
chromium_src-3bf73d5ec779ce14a04a00d24d71a038fd954832.tar.bz2
Revive FileAPI's recursive CreateDirectory.
PPAPI's MakeDirectoryIncludingAncestors() (ppapi/cpp/dev/file_ref_dev.cc) uses recursive CreateDirectory. BUG=74841 TEST=none Review URL: http://codereview.chromium.org/6627028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77204 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi/file_system_file_util.cc')
-rw-r--r--webkit/fileapi/file_system_file_util.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/webkit/fileapi/file_system_file_util.cc b/webkit/fileapi/file_system_file_util.cc
index 52f2c70..c5e8fef 100644
--- a/webkit/fileapi/file_system_file_util.cc
+++ b/webkit/fileapi/file_system_file_util.cc
@@ -157,16 +157,20 @@ PlatformFileError FileSystemFileUtil::ReadDirectory(
PlatformFileError FileSystemFileUtil::CreateDirectory(
FileSystemOperationContext* unused,
const FilePath& file_path,
- bool exclusive) {
- bool path_exists = file_util::PathExists(file_path);
- if (!file_util::PathExists(file_path.DirName()))
- return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+ bool exclusive,
+ bool recursive) {
// If parent dir of file doesn't exist.
+ if (!recursive && !file_util::PathExists(file_path.DirName()))
+ return base::PLATFORM_FILE_ERROR_NOT_FOUND;
+
+ bool path_exists = file_util::PathExists(file_path);
if (exclusive && path_exists)
return base::PLATFORM_FILE_ERROR_EXISTS;
+
// If file exists at the path.
if (path_exists && !file_util::DirectoryExists(file_path))
return base::PLATFORM_FILE_ERROR_EXISTS;
+
if (!file_util::CreateDirectory(file_path))
return base::PLATFORM_FILE_ERROR_FAILED;
return base::PLATFORM_FILE_OK;