| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 if (ShouldSkip(cur_file)) | 126 if (ShouldSkip(cur_file)) |
| 127 continue; | 127 continue; |
| 128 | 128 |
| 129 // Construct the absolute filename. | 129 // Construct the absolute filename. |
| 130 cur_file = root_path_.Append(find_data_.cFileName); | 130 cur_file = root_path_.Append(find_data_.cFileName); |
| 131 | 131 |
| 132 if (find_data_.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { | 132 if (find_data_.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { |
| 133 if (recursive_) { | 133 if (recursive_) { |
| 134 // If |cur_file| is a directory, and we are doing recursive searching, | 134 // If |cur_file| is a directory, and we are doing recursive searching, |
| 135 // add it to pending_paths_ so we scan it after we finish scanning this | 135 // add it to pending_paths_ so we scan it after we finish scanning this |
| 136 // directory. However, don't do recursion through reparse points or we | 136 // directory. |
| 137 // may end up with an infinite cycle. | 137 pending_paths_.push(cur_file); |
| 138 if (!(find_data_.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) | |
| 139 pending_paths_.push(cur_file); | |
| 140 } | 138 } |
| 141 if (file_type_ & FileEnumerator::DIRECTORIES) | 139 if (file_type_ & FileEnumerator::DIRECTORIES) |
| 142 return cur_file; | 140 return cur_file; |
| 143 } else if (file_type_ & FileEnumerator::FILES) { | 141 } else if (file_type_ & FileEnumerator::FILES) { |
| 144 return cur_file; | 142 return cur_file; |
| 145 } | 143 } |
| 146 } | 144 } |
| 147 | 145 |
| 148 return FilePath(); | 146 return FilePath(); |
| 149 } | 147 } |
| 150 | 148 |
| 151 } // namespace base | 149 } // namespace base |
| OLD | NEW |