summaryrefslogtreecommitdiffstats
path: root/base/file_util.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-01 23:07:36 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-01 23:07:36 +0000
commit5553d5bcd8c1f0d90d74a2a52a4c9af51d730d01 (patch)
treef719fa0c440cb3492ccf9c9a2739afd5af5eace6 /base/file_util.cc
parent10c1234fe5e6b43cd9f2f03f91da2c96083c7643 (diff)
downloadchromium_src-5553d5bcd8c1f0d90d74a2a52a4c9af51d730d01.zip
chromium_src-5553d5bcd8c1f0d90d74a2a52a4c9af51d730d01.tar.gz
chromium_src-5553d5bcd8c1f0d90d74a2a52a4c9af51d730d01.tar.bz2
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
Diffstat (limited to 'base/file_util.cc')
-rw-r--r--base/file_util.cc37
1 files changed, 6 insertions, 31 deletions
diff --git a/base/file_util.cc b/base/file_util.cc
index 049bb36..bf5ce23 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;