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

Unified Diff: base/file_util_posix.cc

Issue 46020: Implement DownloadFile::Rename() for posix. Downloads work on linux! (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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') | chrome/browser/download/download_file.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 11648)
+++ base/file_util_posix.cc (working copy)
@@ -107,8 +107,14 @@
}
bool Move(const FilePath& from_path, const FilePath& to_path) {
- return (rename(from_path.value().c_str(),
- to_path.value().c_str()) == 0);
+ if (rename(from_path.value().c_str(), to_path.value().c_str()) == 0)
+ return true;
+
+ if (!CopyDirectory(from_path, to_path, true))
+ return false;
+
+ Delete(from_path, true);
+ return true;
}
bool CopyDirectory(const FilePath& from_path,
« no previous file with comments | « base/file_util.h ('k') | chrome/browser/download/download_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698