Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 78 *path = FilePath(full_path); | 78 *path = FilePath(full_path); |
| 79 return true; | 79 return true; |
| 80 } | 80 } |
| 81 | 81 |
| 82 int CountFilesCreatedAfter(const FilePath& path, | 82 int CountFilesCreatedAfter(const FilePath& path, |
| 83 const base::Time& comparison_time) { | 83 const base::Time& comparison_time) { |
| 84 int file_count = 0; | 84 int file_count = 0; |
| 85 | 85 |
| 86 DIR* dir = opendir(path.value().c_str()); | 86 DIR* dir = opendir(path.value().c_str()); |
| 87 if (dir) { | 87 if (dir) { |
| 88 #if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_FREEBSD) | 88 #if !defined(OS_POSIX) |
|
agl
2009/12/14 19:31:26
This is defeating the intent of the #ifdef which i
| |
| 89 #error Depending on the definition of struct dirent, additional space for \ | 89 #error Depending on the definition of struct dirent, additional space for \ |
| 90 pathname may be needed | 90 pathname may be needed |
| 91 #endif | 91 #endif |
| 92 struct dirent ent_buf; | 92 struct dirent ent_buf; |
| 93 struct dirent* ent; | 93 struct dirent* ent; |
| 94 while (readdir_r(dir, &ent_buf, &ent) == 0 && ent) { | 94 while (readdir_r(dir, &ent_buf, &ent) == 0 && ent) { |
| 95 if ((strcmp(ent->d_name, ".") == 0) || | 95 if ((strcmp(ent->d_name, ".") == 0) || |
| 96 (strcmp(ent->d_name, "..") == 0)) | 96 (strcmp(ent->d_name, "..") == 0)) |
| 97 continue; | 97 continue; |
| 98 | 98 |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 623 return root_path_.Append(directory_entries_[current_directory_entry_ | 623 return root_path_.Append(directory_entries_[current_directory_entry_ |
| 624 ].filename); | 624 ].filename); |
| 625 } | 625 } |
| 626 | 626 |
| 627 bool FileEnumerator::ReadDirectory(std::vector<DirectoryEntryInfo>* entries, | 627 bool FileEnumerator::ReadDirectory(std::vector<DirectoryEntryInfo>* entries, |
| 628 const FilePath& source, bool show_links) { | 628 const FilePath& source, bool show_links) { |
| 629 DIR* dir = opendir(source.value().c_str()); | 629 DIR* dir = opendir(source.value().c_str()); |
| 630 if (!dir) | 630 if (!dir) |
| 631 return false; | 631 return false; |
| 632 | 632 |
| 633 #if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_FREEBSD) | 633 #if !defined(OS_POSIX) |
|
agl
2009/12/14 19:31:26
Likewise.
| |
| 634 #error Depending on the definition of struct dirent, additional space for \ | 634 #error Depending on the definition of struct dirent, additional space for \ |
| 635 pathname may be needed | 635 pathname may be needed |
| 636 #endif | 636 #endif |
| 637 struct dirent dent_buf; | 637 struct dirent dent_buf; |
| 638 struct dirent* dent; | 638 struct dirent* dent; |
| 639 while (readdir_r(dir, &dent_buf, &dent) == 0 && dent) { | 639 while (readdir_r(dir, &dent_buf, &dent) == 0 && dent) { |
| 640 DirectoryEntryInfo info; | 640 DirectoryEntryInfo info; |
| 641 info.filename = FilePath(dent->d_name); | 641 info.filename = FilePath(dent->d_name); |
| 642 | 642 |
| 643 FilePath full_name = source.Append(dent->d_name); | 643 FilePath full_name = source.Append(dent->d_name); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 697 length_ = 0; | 697 length_ = 0; |
| 698 file_ = base::kInvalidPlatformFileValue; | 698 file_ = base::kInvalidPlatformFileValue; |
| 699 } | 699 } |
| 700 | 700 |
| 701 bool HasFileBeenModifiedSince(const FileEnumerator::FindInfo& find_info, | 701 bool HasFileBeenModifiedSince(const FileEnumerator::FindInfo& find_info, |
| 702 const base::Time& cutoff_time) { | 702 const base::Time& cutoff_time) { |
| 703 return find_info.stat.st_mtime >= cutoff_time.ToTimeT(); | 703 return find_info.stat.st_mtime >= cutoff_time.ToTimeT(); |
| 704 } | 704 } |
| 705 | 705 |
| 706 } // namespace file_util | 706 } // namespace file_util |
| OLD | NEW |