Move DeleteAfterReboot, Move, and ReplaceFile to base namespace
Rename ReplaceFileAndGetError (only used once) to ReplaceFile (used 5 times) and have each of those callers specify NULL for the output error if they don't care.
Remove InsertBeforeExtension from file_util.cc which seems to be unused.
BUG=
Review URL: https://codereview.chromium.org/18383003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@209532 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/base/file_util.cc b/base/file_util.cc
index 049bb36..bf5ce2343 100644
--- a/base/file_util.cc
+++ b/base/file_util.cc
@@ -44,6 +44,12 @@
return running_size;
}
+bool Move(const FilePath& from_path, const FilePath& to_path) {
+ if (from_path.ReferencesParent() || to_path.ReferencesParent())
+ return false;
+ return MoveUnsafe(from_path, to_path);
+}
+
} // namespace base
// -----------------------------------------------------------------------------
@@ -55,37 +61,6 @@
using base::kExtensionSeparator;
using base::kMaxUniqueFiles;
-void InsertBeforeExtension(FilePath* path, const FilePath::StringType& suffix) {
- FilePath::StringType& value =
- const_cast<FilePath::StringType&>(path->value());
-
- const FilePath::StringType::size_type last_dot =
- value.rfind(kExtensionSeparator);
- const FilePath::StringType::size_type last_separator =
- value.find_last_of(FilePath::StringType(FilePath::kSeparators));
-
- if (last_dot == FilePath::StringType::npos ||
- (last_separator != std::wstring::npos && last_dot < last_separator)) {
- // The path looks something like "C:\pics.old\jojo" or "C:\pics\jojo".
- // We should just append the suffix to the entire path.
- value.append(suffix);
- return;
- }
-
- value.insert(last_dot, suffix);
-}
-
-bool Move(const FilePath& from_path, const FilePath& to_path) {
- if (from_path.ReferencesParent() || to_path.ReferencesParent())
- return false;
- return MoveUnsafe(from_path, to_path);
-}
-
-bool ReplaceFile(const base::FilePath& from_path,
- const base::FilePath& to_path) {
- return ReplaceFileAndGetError(from_path, to_path, NULL);
-}
-
bool CopyFile(const FilePath& from_path, const FilePath& to_path) {
if (from_path.ReferencesParent() || to_path.ReferencesParent())
return false;