file_enumerator.cc 755 B

12345678910111213141516171819202122232425
  1. // Copyright (c) 2013 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "base/files/file_enumerator.h"
  5. #include "base/files/file_util.h"
  6. namespace base {
  7. FileEnumerator::FileInfo::~FileInfo() = default;
  8. bool FileEnumerator::ShouldSkip(const FilePath& path) {
  9. FilePath::StringType basename = path.BaseName().value();
  10. return basename == FILE_PATH_LITERAL(".") ||
  11. (basename == FILE_PATH_LITERAL("..") &&
  12. !(INCLUDE_DOT_DOT & file_type_));
  13. }
  14. bool FileEnumerator::IsTypeMatched(bool is_dir) const {
  15. return (file_type_ &
  16. (is_dir ? FileEnumerator::DIRECTORIES : FileEnumerator::FILES)) != 0;
  17. }
  18. } // namespace base