summaryrefslogtreecommitdiffstats
path: root/base/file_util_posix.cc
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-18 17:13:03 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-18 17:13:03 +0000
commit1b6462cde9859ae75da58fc1a566e272a381fd0b (patch)
treef7f08c70aa68c9bf39ecaa7d2eb5228db1a43b92 /base/file_util_posix.cc
parentc6d705d0c659bbd9b8f5b59ab3ab79dbd07dc242 (diff)
downloadchromium_src-1b6462cde9859ae75da58fc1a566e272a381fd0b.zip
chromium_src-1b6462cde9859ae75da58fc1a566e272a381fd0b.tar.gz
chromium_src-1b6462cde9859ae75da58fc1a566e272a381fd0b.tar.bz2
Add file_util::ReplaceFile and use it in ImportantFileWriter.
It has more strict semantics than file_util::Move. http://crbug.com/11585 Review URL: http://codereview.chromium.org/113207 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16291 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util_posix.cc')
-rw-r--r--base/file_util_posix.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index 96c1c17..5d44ca3 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -168,6 +168,10 @@ bool Move(const FilePath& from_path, const FilePath& to_path) {
return true;
}
+bool ReplaceFile(const FilePath& from_path, const FilePath& to_path) {
+ return (rename(from_path.value().c_str(), to_path.value().c_str()) == 0);
+}
+
bool CopyDirectory(const FilePath& from_path,
const FilePath& to_path,
bool recursive) {