OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 DCHECK(info); | 767 DCHECK(info); |
768 | 768 |
769 if (current_directory_entry_ >= directory_entries_.size()) | 769 if (current_directory_entry_ >= directory_entries_.size()) |
770 return; | 770 return; |
771 | 771 |
772 DirectoryEntryInfo* cur_entry = &directory_entries_[current_directory_entry_]; | 772 DirectoryEntryInfo* cur_entry = &directory_entries_[current_directory_entry_]; |
773 memcpy(&(info->stat), &(cur_entry->stat), sizeof(info->stat)); | 773 memcpy(&(info->stat), &(cur_entry->stat), sizeof(info->stat)); |
774 info->filename.assign(cur_entry->filename.value()); | 774 info->filename.assign(cur_entry->filename.value()); |
775 } | 775 } |
776 | 776 |
| 777 // static |
777 bool FileEnumerator::IsDirectory(const FindInfo& info) { | 778 bool FileEnumerator::IsDirectory(const FindInfo& info) { |
778 return S_ISDIR(info.stat.st_mode); | 779 return S_ISDIR(info.stat.st_mode); |
779 } | 780 } |
780 | 781 |
781 // static | 782 // static |
| 783 bool FileEnumerator::IsLink(const FindInfo& info) { |
| 784 return S_ISLNK(info.stat.st_mode); |
| 785 } |
| 786 |
| 787 // static |
782 FilePath FileEnumerator::GetFilename(const FindInfo& find_info) { | 788 FilePath FileEnumerator::GetFilename(const FindInfo& find_info) { |
783 return FilePath(find_info.filename); | 789 return FilePath(find_info.filename); |
784 } | 790 } |
785 | 791 |
786 // static | 792 // static |
787 int64 FileEnumerator::GetFilesize(const FindInfo& find_info) { | 793 int64 FileEnumerator::GetFilesize(const FindInfo& find_info) { |
788 return find_info.stat.st_size; | 794 return find_info.stat.st_size; |
789 } | 795 } |
790 | 796 |
791 // static | 797 // static |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1096 | 1102 |
1097 allowed_group_ids.insert(group_record->gr_gid); | 1103 allowed_group_ids.insert(group_record->gr_gid); |
1098 } | 1104 } |
1099 | 1105 |
1100 return VerifyPathControlledByUser( | 1106 return VerifyPathControlledByUser( |
1101 kFileSystemRoot, path, kRootUid, allowed_group_ids); | 1107 kFileSystemRoot, path, kRootUid, allowed_group_ids); |
1102 } | 1108 } |
1103 #endif // defined(OS_MACOSX) | 1109 #endif // defined(OS_MACOSX) |
1104 | 1110 |
1105 } // namespace file_util | 1111 } // namespace file_util |
OLD | NEW |