summaryrefslogtreecommitdiffstats
path: root/base/file_util.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-12 05:17:15 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-12 05:17:15 +0000
commit154769362a046967efd14bb0a0da5d6f3a301e32 (patch)
tree33e4550cd4f8895b639fabc55b45f5bb6e8d67bc /base/file_util.cc
parente7a810943e48e9649db8063058fb77ddefaf9f96 (diff)
downloadchromium_src-154769362a046967efd14bb0a0da5d6f3a301e32.zip
chromium_src-154769362a046967efd14bb0a0da5d6f3a301e32.tar.gz
chromium_src-154769362a046967efd14bb0a0da5d6f3a301e32.tar.bz2
Move path functions from file_util to FilePath object.
EnsureEndsWithSeparator used to check whether the file existed. This seems bad and unnecessary so I removed it. I removed file_util::ContainsPath and used the existing file_util::IsParent instead. The functions descriptions are the same but the implementations do slightly different things, which is worrying. The only non-test use of this function to worry about is content/browser/storage_partition_impl_map.cc. As far as I see, the requirements for this seem OK, but I'm not very familiar with this. After some discussion with akalin, I changed sync/internal_api/sync_manager_impl.cc to be a DCHECK that the path is absolute rather than make it absolute. The old code relied on the behavior of the old function that the argument would be unchanged if the file didn't exist, and this (possibly relative) path would be used later. This behavior doesn't make a lot of sense, and it looks like now that the path is always absolute, so I replaced this call with a DCHECK. BUG= Review URL: https://codereview.chromium.org/13196006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193855 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util.cc')
-rw-r--r--base/file_util.cc49
1 files changed, 0 insertions, 49 deletions
diff --git a/base/file_util.cc b/base/file_util.cc
index 3e7dc445..16fee2c 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);