| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/file_util.h" | 5 #include "base/file_util.h" |
| 6 | 6 |
| 7 #include <dirent.h> | 7 #include <dirent.h> |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <fcntl.h> | 9 #include <fcntl.h> |
| 10 #include <fnmatch.h> | 10 #include <fnmatch.h> |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 return true; | 80 return true; |
| 81 } | 81 } |
| 82 | 82 |
| 83 int CountFilesCreatedAfter(const FilePath& path, | 83 int CountFilesCreatedAfter(const FilePath& path, |
| 84 const base::Time& comparison_time) { | 84 const base::Time& comparison_time) { |
| 85 int file_count = 0; | 85 int file_count = 0; |
| 86 | 86 |
| 87 DIR* dir = opendir(path.value().c_str()); | 87 DIR* dir = opendir(path.value().c_str()); |
| 88 if (dir) { | 88 if (dir) { |
| 89 #if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_FREEBSD) && \ | 89 #if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_FREEBSD) && \ |
| 90 !defined(OS_OPENBSD) | 90 !defined(OS_OPENBSD) && !defined(OS_SOLARIS) |
| 91 #error Port warning: depending on the definition of struct dirent, \ | 91 #error Port warning: depending on the definition of struct dirent, \ |
| 92 additional space for pathname may be needed | 92 additional space for pathname may be needed |
| 93 #endif | 93 #endif |
| 94 struct dirent ent_buf; | 94 struct dirent ent_buf; |
| 95 struct dirent* ent; | 95 struct dirent* ent; |
| 96 while (readdir_r(dir, &ent_buf, &ent) == 0 && ent) { | 96 while (readdir_r(dir, &ent_buf, &ent) == 0 && ent) { |
| 97 if ((strcmp(ent->d_name, ".") == 0) || | 97 if ((strcmp(ent->d_name, ".") == 0) || |
| 98 (strcmp(ent->d_name, "..") == 0)) | 98 (strcmp(ent->d_name, "..") == 0)) |
| 99 continue; | 99 continue; |
| 100 | 100 |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 ].filename); | 638 ].filename); |
| 639 } | 639 } |
| 640 | 640 |
| 641 bool FileEnumerator::ReadDirectory(std::vector<DirectoryEntryInfo>* entries, | 641 bool FileEnumerator::ReadDirectory(std::vector<DirectoryEntryInfo>* entries, |
| 642 const FilePath& source, bool show_links) { | 642 const FilePath& source, bool show_links) { |
| 643 DIR* dir = opendir(source.value().c_str()); | 643 DIR* dir = opendir(source.value().c_str()); |
| 644 if (!dir) | 644 if (!dir) |
| 645 return false; | 645 return false; |
| 646 | 646 |
| 647 #if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_FREEBSD) && \ | 647 #if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_FREEBSD) && \ |
| 648 !defined(OS_OPENBSD) | 648 !defined(OS_OPENBSD) && !defined(OS_SOLARIS) |
| 649 #error Port warning: depending on the definition of struct dirent, \ | 649 #error Port warning: depending on the definition of struct dirent, \ |
| 650 additional space for pathname may be needed | 650 additional space for pathname may be needed |
| 651 #endif | 651 #endif |
| 652 | 652 |
| 653 struct dirent dent_buf; | 653 struct dirent dent_buf; |
| 654 struct dirent* dent; | 654 struct dirent* dent; |
| 655 while (readdir_r(dir, &dent_buf, &dent) == 0 && dent) { | 655 while (readdir_r(dir, &dent_buf, &dent) == 0 && dent) { |
| 656 DirectoryEntryInfo info; | 656 DirectoryEntryInfo info; |
| 657 info.filename = FilePath(dent->d_name); | 657 info.filename = FilePath(dent->d_name); |
| 658 | 658 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 length_ = 0; | 713 length_ = 0; |
| 714 file_ = base::kInvalidPlatformFileValue; | 714 file_ = base::kInvalidPlatformFileValue; |
| 715 } | 715 } |
| 716 | 716 |
| 717 bool HasFileBeenModifiedSince(const FileEnumerator::FindInfo& find_info, | 717 bool HasFileBeenModifiedSince(const FileEnumerator::FindInfo& find_info, |
| 718 const base::Time& cutoff_time) { | 718 const base::Time& cutoff_time) { |
| 719 return find_info.stat.st_mtime >= cutoff_time.ToTimeT(); | 719 return find_info.stat.st_mtime >= cutoff_time.ToTimeT(); |
| 720 } | 720 } |
| 721 | 721 |
| 722 } // namespace file_util | 722 } // namespace file_util |
| OLD | NEW |