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

Unified Diff: base/file_util.cc

Issue 18383003: Move DeleteAfterReboot and Move to base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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') | base/file_util_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util.cc
diff --git a/base/file_util.cc b/base/file_util.cc
index 049bb36815274333e0c460681665ec2ba1df63ee..bf5ce2343bfaae92ab07244036d6ab3c9e1e1038 100644
--- a/base/file_util.cc
+++ b/base/file_util.cc
@@ -44,6 +44,12 @@ int64 ComputeDirectorySize(const FilePath& root_path) {
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::FilePath;
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;
« no previous file with comments | « base/file_util.h ('k') | base/file_util_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698