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

Unified Diff: base/file_util.cc

Issue 13196006: Move path functions from file_util to FilePath object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git try Created 7 years, 8 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
Index: base/file_util.cc
diff --git a/base/file_util.cc b/base/file_util.cc
index 3e7dc4456d122bff5e0037c5bfa95f45eb9b547a..16fee2c8d8ddbe49f0b67675dd58e02402083c0e 100644
--- a/base/file_util.cc
+++ b/base/file_util.cc
@@ -37,28 +37,6 @@ namespace file_util {
bool g_bug108724_debug = false;
-bool EndsWithSeparator(const FilePath& path) {
- FilePath::StringType value = path.value();
- if (value.empty())
- return false;
-
- return FilePath::IsSeparator(value[value.size() - 1]);
-}
-
-bool EnsureEndsWithSeparator(FilePath* path) {
- if (!DirectoryExists(*path))
- return false;
-
- if (EndsWithSeparator(*path))
- return true;
-
- FilePath::StringType& path_str =
- const_cast<FilePath::StringType&>(path->value());
- path_str.append(&FilePath::kSeparators[0], 1);
-
- return true;
-}
-
void InsertBeforeExtension(FilePath* path, const FilePath::StringType& suffix) {
FilePath::StringType& value =
const_cast<FilePath::StringType&>(path->value());
@@ -289,33 +267,6 @@ int GetUniquePathNumber(
return -1;
}
-bool ContainsPath(const FilePath &parent, const FilePath& child) {
- FilePath abs_parent = FilePath(parent);
- FilePath abs_child = FilePath(child);
-
- if (!file_util::AbsolutePath(&abs_parent) ||
- !file_util::AbsolutePath(&abs_child))
- return false;
-
-#if defined(OS_WIN)
- // file_util::AbsolutePath() does not flatten case on Windows, so we must do
- // a case-insensitive compare.
- if (!StartsWith(abs_child.value(), abs_parent.value(), false))
-#else
- if (!StartsWithASCII(abs_child.value(), abs_parent.value(), true))
-#endif
- return false;
-
- // file_util::AbsolutePath() normalizes '/' to '\' on Windows, so we only need
- // to check kSeparators[0].
- if (abs_child.value().length() <= abs_parent.value().length() ||
- abs_child.value()[abs_parent.value().length()] !=
- FilePath::kSeparators[0])
- return false;
-
- return true;
-}
-
int64 ComputeDirectorySize(const FilePath& root_path) {
int64 running_size = 0;
FileEnumerator file_iter(root_path, true, FileEnumerator::FILES);

Powered by Google App Engine
This is Rietveld 408576698