summaryrefslogtreecommitdiffstats
path: root/base/file_util_posix.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-13 20:01:43 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-13 20:01:43 +0000
commitcc7948aeb5fe21af08a2d5e868c0087ded0d244a (patch)
tree8d3078af6ecb3a8e5e558b53a4da20e1e35fb656 /base/file_util_posix.cc
parentc9938e6d17e8464ce8577dccb98e19e7e5515cf0 (diff)
downloadchromium_src-cc7948aeb5fe21af08a2d5e868c0087ded0d244a.zip
chromium_src-cc7948aeb5fe21af08a2d5e868c0087ded0d244a.tar.gz
chromium_src-cc7948aeb5fe21af08a2d5e868c0087ded0d244a.tar.bz2
Implement DownloadFile::Rename() for posix. Downloads work on linux!
Review URL: http://codereview.chromium.org/46020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11659 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util_posix.cc')
-rw-r--r--base/file_util_posix.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index 85cdc10..235e6c0 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -107,8 +107,14 @@ bool Delete(const FilePath& path, bool recursive) {
}
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,