| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/files/file_enumerator.h" | 5 #include "base/files/file_enumerator.h" |
| 6 | 6 |
| 7 #include <dirent.h> | 7 #include <dirent.h> |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <fnmatch.h> | 9 #include <fnmatch.h> |
| 10 #include <stdint.h> |
| 10 | 11 |
| 11 #include "base/logging.h" | 12 #include "base/logging.h" |
| 12 #include "base/threading/thread_restrictions.h" | 13 #include "base/threading/thread_restrictions.h" |
| 14 #include "build/build_config.h" |
| 13 | 15 |
| 14 namespace base { | 16 namespace base { |
| 15 | 17 |
| 16 // FileEnumerator::FileInfo ---------------------------------------------------- | 18 // FileEnumerator::FileInfo ---------------------------------------------------- |
| 17 | 19 |
| 18 FileEnumerator::FileInfo::FileInfo() { | 20 FileEnumerator::FileInfo::FileInfo() { |
| 19 memset(&stat_, 0, sizeof(stat_)); | 21 memset(&stat_, 0, sizeof(stat_)); |
| 20 } | 22 } |
| 21 | 23 |
| 22 bool FileEnumerator::FileInfo::IsDirectory() const { | 24 bool FileEnumerator::FileInfo::IsDirectory() const { |
| 23 return S_ISDIR(stat_.st_mode); | 25 return S_ISDIR(stat_.st_mode); |
| 24 } | 26 } |
| 25 | 27 |
| 26 FilePath FileEnumerator::FileInfo::GetName() const { | 28 FilePath FileEnumerator::FileInfo::GetName() const { |
| 27 return filename_; | 29 return filename_; |
| 28 } | 30 } |
| 29 | 31 |
| 30 int64 FileEnumerator::FileInfo::GetSize() const { | 32 int64_t FileEnumerator::FileInfo::GetSize() const { |
| 31 return stat_.st_size; | 33 return stat_.st_size; |
| 32 } | 34 } |
| 33 | 35 |
| 34 base::Time FileEnumerator::FileInfo::GetLastModifiedTime() const { | 36 base::Time FileEnumerator::FileInfo::GetLastModifiedTime() const { |
| 35 return base::Time::FromTimeT(stat_.st_mtime); | 37 return base::Time::FromTimeT(stat_.st_mtime); |
| 36 } | 38 } |
| 37 | 39 |
| 38 // FileEnumerator -------------------------------------------------------------- | 40 // FileEnumerator -------------------------------------------------------------- |
| 39 | 41 |
| 40 FileEnumerator::FileEnumerator(const FilePath& root_path, | 42 FileEnumerator::FileEnumerator(const FilePath& root_path, |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 memset(&info.stat_, 0, sizeof(info.stat_)); | 153 memset(&info.stat_, 0, sizeof(info.stat_)); |
| 152 } | 154 } |
| 153 entries->push_back(info); | 155 entries->push_back(info); |
| 154 } | 156 } |
| 155 | 157 |
| 156 closedir(dir); | 158 closedir(dir); |
| 157 return true; | 159 return true; |
| 158 } | 160 } |
| 159 | 161 |
| 160 } // namespace base | 162 } // namespace base |
| OLD | NEW |