Add recursive flag to file_util_proxy::CreateDirectory.
BUG=54352
TEST=all the FileSystemOperationTest.TestCreateDir* should continue to pass
Review URL: http://codereview.chromium.org/3293009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58781 0039d316-1c4b-4281-b951-d872f2087c98
CrOS-Libchrome-Original-Commit: 8b20191a72da085319a68e4953e9f2b355218825
diff --git a/base/file_util_proxy.cc b/base/file_util_proxy.cc
index 1e6100e..6e4222d 100644
--- a/base/file_util_proxy.cc
+++ b/base/file_util_proxy.cc
@@ -320,17 +320,19 @@
RelayCreateDirectory(
const FilePath& file_path,
bool exclusive,
+ bool recursive,
base::FileUtilProxy::StatusCallback* callback)
: RelayWithStatusCallback(callback),
file_path_(file_path),
- exclusive_(exclusive) {
+ exclusive_(exclusive),
+ recursive_(recursive) {
}
protected:
virtual void RunWork() {
bool path_exists = file_util::PathExists(file_path_);
// If parent dir of file doesn't exist.
- if (!file_util::PathExists(file_path_.DirName())) {
+ if (!recursive_ && !file_util::PathExists(file_path_.DirName())) {
set_error_code(base::PLATFORM_FILE_ERROR_NOT_FOUND);
return;
}
@@ -350,6 +352,7 @@
private:
FilePath file_path_;
bool exclusive_;
+ bool recursive_;
};
class RelayReadDirectory : public MessageLoopRelay {
@@ -458,9 +461,10 @@
scoped_refptr<MessageLoopProxy> message_loop_proxy,
const FilePath& file_path,
bool exclusive,
+ bool recursive,
StatusCallback* callback) {
return Start(FROM_HERE, message_loop_proxy, new RelayCreateDirectory(
- file_path, exclusive, callback));
+ file_path, exclusive, recursive, callback));
}
// static
diff --git a/base/file_util_proxy.h b/base/file_util_proxy.h
index 9e9b95e..929dcd7 100644
--- a/base/file_util_proxy.h
+++ b/base/file_util_proxy.h
@@ -97,6 +97,7 @@
scoped_refptr<MessageLoopProxy> message_loop_proxy,
const FilePath& file_path,
bool exclusive,
+ bool recursive,
StatusCallback* callback);
// Deletes a file or empty directory.