| 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 <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 140 |
| 141 // Construct the absolute filename. | 141 // Construct the absolute filename. |
| 142 cur_file = root_path_.Append(find_data_.cFileName); | 142 cur_file = root_path_.Append(find_data_.cFileName); |
| 143 | 143 |
| 144 if (find_data_.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { | 144 if (find_data_.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { |
| 145 if (recursive_) { | 145 if (recursive_) { |
| 146 // If |cur_file| is a directory, and we are doing recursive searching, | 146 // If |cur_file| is a directory, and we are doing recursive searching, |
| 147 // add it to pending_paths_ so we scan it after we finish scanning this | 147 // add it to pending_paths_ so we scan it after we finish scanning this |
| 148 // directory. However, don't do recursion through reparse points or we | 148 // directory. However, don't do recursion through reparse points or we |
| 149 // may end up with an infinite cycle. | 149 // may end up with an infinite cycle. |
| 150 if (!(find_data_.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) | 150 DWORD attributes = GetFileAttributes(cur_file.value().c_str()); |
| 151 if (!(attributes & FILE_ATTRIBUTE_REPARSE_POINT)) |
| 151 pending_paths_.push(cur_file); | 152 pending_paths_.push(cur_file); |
| 152 } | 153 } |
| 153 if (file_type_ & FileEnumerator::DIRECTORIES) | 154 if (file_type_ & FileEnumerator::DIRECTORIES) |
| 154 return cur_file; | 155 return cur_file; |
| 155 } else if (file_type_ & FileEnumerator::FILES) { | 156 } else if (file_type_ & FileEnumerator::FILES) { |
| 156 return cur_file; | 157 return cur_file; |
| 157 } | 158 } |
| 158 } | 159 } |
| 159 | 160 |
| 160 return FilePath(); | 161 return FilePath(); |
| 161 } | 162 } |
| 162 | 163 |
| 163 } // namespace base | 164 } // namespace base |
| OLD | NEW |