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

Unified Diff: base/file_util_proxy.cc

Issue 3293009: Add recursive flag to file_util_proxy::CreateDirectory (Closed)
Patch Set: rebased Created 10 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_proxy.h ('k') | chrome/browser/file_system/file_system_operation.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util_proxy.cc
diff --git a/base/file_util_proxy.cc b/base/file_util_proxy.cc
index 1e6100e59726f78c3a19e4f5fc0b37b163935dba..6e4222d51bd67683675dff9278c4e26381b9132d 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<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
« no previous file with comments | « base/file_util_proxy.h ('k') | chrome/browser/file_system/file_system_operation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698