diff options
author | evanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-23 01:15:25 +0000 |
---|---|---|
committer | evanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-23 01:15:25 +0000 |
commit | 9516babc4a834ec72508b35fb86741f9254f5419 (patch) | |
tree | c4c87989345802e4ec59aa4eb41d144de8f98f32 | |
parent | 9364b8df98868d254ee4bfe96775790831149035 (diff) | |
download | chromium_src-9516babc4a834ec72508b35fb86741f9254f5419.zip chromium_src-9516babc4a834ec72508b35fb86741f9254f5419.tar.gz chromium_src-9516babc4a834ec72508b35fb86741f9254f5419.tar.bz2 |
Fix DeleteCache on POSIX. It wasn't successfully deleting before.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2468 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | net/disk_cache/cache_util_posix.cc | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/net/disk_cache/cache_util_posix.cc b/net/disk_cache/cache_util_posix.cc index 80134b4..ca99cec 100644 --- a/net/disk_cache/cache_util_posix.cc +++ b/net/disk_cache/cache_util_posix.cc @@ -16,13 +16,16 @@ bool MoveCache(const std::wstring& from_path, const std::wstring& to_path) { } void DeleteCache(const std::wstring& path, bool remove_folder) { + file_util::FileEnumerator iter(path, /* recursive */ false, + file_util::FileEnumerator::FILES); + for (std::wstring file = iter.Next(); !file.empty(); file = iter.Next()) { + if (!file_util::Delete(file, /* recursive */ false)) + NOTREACHED(); + } + if (remove_folder) { - file_util::Delete(path, false); - } else { - std::wstring name(path); - // TODO(rvargas): Fix this after file_util::delete is fixed. - // file_util::AppendToPath(&name, L"*"); - file_util::Delete(name, true); + if (!file_util::Delete(path, /* recursive */ false)) + NOTREACHED(); } } @@ -37,4 +40,3 @@ void WaitForPendingIO(int* num_pending_io) { } } // namespace disk_cache - |