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 <windows.h> | 7 #include <windows.h> |
8 #include <shellapi.h> | 8 #include <shellapi.h> |
9 #include <shlobj.h> | 9 #include <shlobj.h> |
10 #include <time.h> | 10 #include <time.h> |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 pattern_(pattern), | 618 pattern_(pattern), |
619 find_handle_(INVALID_HANDLE_VALUE) { | 619 find_handle_(INVALID_HANDLE_VALUE) { |
620 pending_paths_.push(root_path); | 620 pending_paths_.push(root_path); |
621 } | 621 } |
622 | 622 |
623 FileEnumerator::~FileEnumerator() { | 623 FileEnumerator::~FileEnumerator() { |
624 if (find_handle_ != INVALID_HANDLE_VALUE) | 624 if (find_handle_ != INVALID_HANDLE_VALUE) |
625 FindClose(find_handle_); | 625 FindClose(find_handle_); |
626 } | 626 } |
627 | 627 |
| 628 void FileEnumerator::GetFindInfo(FindInfo* info) { |
| 629 DCHECK(info); |
| 630 |
| 631 if (!is_in_find_op_) |
| 632 return; |
| 633 |
| 634 memcpy(info, &find_data_, sizeof(*info)); |
| 635 } |
| 636 |
628 std::wstring FileEnumerator::Next() { | 637 std::wstring FileEnumerator::Next() { |
629 if (!is_in_find_op_) { | 638 if (!is_in_find_op_) { |
630 if (pending_paths_.empty()) | 639 if (pending_paths_.empty()) |
631 return std::wstring(); | 640 return std::wstring(); |
632 | 641 |
633 // The last find FindFirstFile operation is done, prepare a new one. | 642 // The last find FindFirstFile operation is done, prepare a new one. |
634 // root_path_ must have the trailing directory character. | 643 // root_path_ must have the trailing directory character. |
635 root_path_ = pending_paths_.top(); | 644 root_path_ = pending_paths_.top(); |
636 file_util::AppendToPath(&root_path_, std::wstring()); | 645 file_util::AppendToPath(&root_path_, std::wstring()); |
637 pending_paths_.pop(); | 646 pending_paths_.pop(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 // it to pending_paths_ so we scan it after we finish scanning this | 691 // it to pending_paths_ so we scan it after we finish scanning this |
683 // directory. | 692 // directory. |
684 pending_paths_.push(cur_file); | 693 pending_paths_.push(cur_file); |
685 } | 694 } |
686 return (file_type_ & FileEnumerator::DIRECTORIES) ? cur_file : Next(); | 695 return (file_type_ & FileEnumerator::DIRECTORIES) ? cur_file : Next(); |
687 } | 696 } |
688 return (file_type_ & FileEnumerator::FILES) ? cur_file : Next(); | 697 return (file_type_ & FileEnumerator::FILES) ? cur_file : Next(); |
689 } | 698 } |
690 | 699 |
691 } // namespace file_util | 700 } // namespace file_util |
OLD | NEW |