From 8b20191a72da085319a68e4953e9f2b355218825 Mon Sep 17 00:00:00 2001 From: "kinuko@chromium.org" Date: Wed, 8 Sep 2010 00:50:41 +0000 Subject: 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 --- base/file_util_proxy.cc | 10 +++++++--- base/file_util_proxy.h | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'base') 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 @@ class RelayCreateDirectory : public RelayWithStatusCallback { 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 @@ class RelayCreateDirectory : public RelayWithStatusCallback { private: FilePath file_path_; bool exclusive_; + bool recursive_; }; class RelayReadDirectory : public MessageLoopRelay { @@ -458,9 +461,10 @@ bool FileUtilProxy::CreateDirectory( scoped_refptr 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 @@ class FileUtilProxy { scoped_refptr message_loop_proxy, const FilePath& file_path, bool exclusive, + bool recursive, StatusCallback* callback); // Deletes a file or empty directory. -- cgit v1.1