Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(526)

Side by Side Diff: base/files/file_enumerator_posix.cc

Issue 2884353004: fuchsia: base_unittests (mostly) compiling (Closed)
Patch Set: rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/BUILD.gn ('k') | base/files/file_util_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <stdint.h>
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 return directory_entries_[current_directory_entry_]; 118 return directory_entries_[current_directory_entry_];
119 } 119 }
120 120
121 bool FileEnumerator::ReadDirectory(std::vector<FileInfo>* entries, 121 bool FileEnumerator::ReadDirectory(std::vector<FileInfo>* entries,
122 const FilePath& source, bool show_links) { 122 const FilePath& source, bool show_links) {
123 base::ThreadRestrictions::AssertIOAllowed(); 123 base::ThreadRestrictions::AssertIOAllowed();
124 DIR* dir = opendir(source.value().c_str()); 124 DIR* dir = opendir(source.value().c_str());
125 if (!dir) 125 if (!dir)
126 return false; 126 return false;
127 127
128 #if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_BSD) && \ 128 #if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_BSD) && \
129 !defined(OS_SOLARIS) && !defined(OS_ANDROID) && !defined(OS_AIX) 129 !defined(OS_SOLARIS) && !defined(OS_ANDROID) && !defined(OS_AIX) && \
130 !defined(OS_FUCHSIA)
130 #error Port warning: depending on the definition of struct dirent, \ 131 #error Port warning: depending on the definition of struct dirent, \
131 additional space for pathname may be needed 132 additional space for pathname may be needed
132 #endif 133 #endif
133 134
134 struct dirent dent_buf; 135 struct dirent dent_buf;
135 struct dirent* dent; 136 struct dirent* dent;
136 while (readdir_r(dir, &dent_buf, &dent) == 0 && dent) { 137 while (readdir_r(dir, &dent_buf, &dent) == 0 && dent) {
137 FileInfo info; 138 FileInfo info;
138 info.filename_ = FilePath(dent->d_name); 139 info.filename_ = FilePath(dent->d_name);
139 140
(...skipping 13 matching lines...) Expand all
153 memset(&info.stat_, 0, sizeof(info.stat_)); 154 memset(&info.stat_, 0, sizeof(info.stat_));
154 } 155 }
155 entries->push_back(info); 156 entries->push_back(info);
156 } 157 }
157 158
158 closedir(dir); 159 closedir(dir);
159 return true; 160 return true;
160 } 161 }
161 162
162 } // namespace base 163 } // namespace base
OLDNEW
« no previous file with comments | « base/BUILD.gn ('k') | base/files/file_util_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698