From ca37f304399948559b6fff0b1829b79d70a2b51b Mon Sep 17 00:00:00 2001 From: "pasko@chromium.org" Date: Tue, 16 Jul 2013 14:43:13 +0000 Subject: Make DeleteCache() recursive This reuses base::FileEnumerator for the task on all platforms. BUG=249362 R=gavinp@chromium.org, rvargas@chromium.org Review URL: https://codereview.chromium.org/19206002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211793 0039d316-1c4b-4281-b951-d872f2087c98 --- net/disk_cache/cache_util_win.cc | 29 ----------------------------- 1 file changed, 29 deletions(-) (limited to 'net/disk_cache/cache_util_win.cc') diff --git a/net/disk_cache/cache_util_win.cc b/net/disk_cache/cache_util_win.cc index 8c54b91..3337511 100644 --- a/net/disk_cache/cache_util_win.cc +++ b/net/disk_cache/cache_util_win.cc @@ -11,29 +11,6 @@ #include "base/message_loop.h" #include "base/win/scoped_handle.h" -namespace { - -// Deletes all the files on path that match search_name pattern. -void DeleteFiles(const base::FilePath& path, const wchar_t* search_name) { - base::FilePath name(path.Append(search_name)); - - WIN32_FIND_DATA data; - HANDLE handle = FindFirstFile(name.value().c_str(), &data); - if (handle == INVALID_HANDLE_VALUE) - return; - - do { - if (data.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY || - data.dwFileAttributes == FILE_ATTRIBUTE_REPARSE_POINT) - continue; - DeleteFile(path.Append(data.cFileName).value().c_str()); - } while (FindNextFile(handle, &data)); - - FindClose(handle); -} - -} // namespace - namespace disk_cache { bool MoveCache(const base::FilePath& from_path, const base::FilePath& to_path) { @@ -46,12 +23,6 @@ bool MoveCache(const base::FilePath& from_path, const base::FilePath& to_path) { return true; } -void DeleteCache(const base::FilePath& path, bool remove_folder) { - DeleteFiles(path, L"*"); - if (remove_folder) - RemoveDirectory(path.value().c_str()); -} - bool DeleteCacheFile(const base::FilePath& name) { // We do a simple delete, without ever falling back to SHFileOperation, as the // version from base does. -- cgit v1.1