Index: base/file_util.cc |
diff --git a/base/file_util.cc b/base/file_util.cc |
index 7425717a921e00bac6825a560db3cb9975650c6a..147983662e2855d45b49620cbcd61fe68f5293c2 100644 |
--- a/base/file_util.cc |
+++ b/base/file_util.cc |
@@ -11,6 +11,7 @@ |
#include <fstream> |
+#include "base/files/file_enumerator.h" |
#include "base/files/file_path.h" |
#include "base/logging.h" |
#include "base/string_util.h" |
@@ -18,6 +19,7 @@ |
#include "base/strings/string_piece.h" |
#include "base/strings/utf_string_conversions.h" |
+using base::FileEnumerator; |
using base::FilePath; |
namespace { |
@@ -170,7 +172,7 @@ bool ReadFileToString(const FilePath& path, std::string* contents) { |
bool IsDirectoryEmpty(const FilePath& dir_path) { |
FileEnumerator files(dir_path, false, |
FileEnumerator::FILES | FileEnumerator::DIRECTORIES); |
- if (files.Next().value().empty()) |
+ if (files.Next().empty()) |
return true; |
return false; |
} |
@@ -267,30 +269,9 @@ int GetUniquePathNumber( |
int64 ComputeDirectorySize(const FilePath& root_path) { |
int64 running_size = 0; |
FileEnumerator file_iter(root_path, true, FileEnumerator::FILES); |
- for (FilePath current = file_iter.Next(); !current.empty(); |
- current = file_iter.Next()) { |
- FileEnumerator::FindInfo info; |
- file_iter.GetFindInfo(&info); |
-#if defined(OS_WIN) |
- LARGE_INTEGER li = { info.nFileSizeLow, info.nFileSizeHigh }; |
- running_size += li.QuadPart; |
-#else |
- running_size += info.stat.st_size; |
-#endif |
- } |
+ while (!file_iter.Next().empty()) |
+ running_size += file_iter.GetInfo().GetSize(); |
return running_size; |
} |
-/////////////////////////////////////////////// |
-// FileEnumerator |
-// |
-// Note: the main logic is in file_util_<platform>.cc |
- |
-bool FileEnumerator::ShouldSkip(const FilePath& path) { |
- FilePath::StringType basename = path.BaseName().value(); |
- return basename == FILE_PATH_LITERAL(".") || |
- (basename == FILE_PATH_LITERAL("..") && |
- !(INCLUDE_DOT_DOT & file_type_)); |
-} |
- |
} // namespace |