OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <propvarutil.h> | 8 #include <propvarutil.h> |
9 #include <psapi.h> | 9 #include <psapi.h> |
10 #include <shellapi.h> | 10 #include <shellapi.h> |
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 base::ThreadRestrictions::AssertIOAllowed(); | 777 base::ThreadRestrictions::AssertIOAllowed(); |
778 BOOL ret = ::SetCurrentDirectory(directory.value().c_str()); | 778 BOOL ret = ::SetCurrentDirectory(directory.value().c_str()); |
779 return ret != 0; | 779 return ret != 0; |
780 } | 780 } |
781 | 781 |
782 /////////////////////////////////////////////// | 782 /////////////////////////////////////////////// |
783 // FileEnumerator | 783 // FileEnumerator |
784 | 784 |
785 FileEnumerator::FileEnumerator(const FilePath& root_path, | 785 FileEnumerator::FileEnumerator(const FilePath& root_path, |
786 bool recursive, | 786 bool recursive, |
787 FileType file_type) | 787 int file_type) |
788 : recursive_(recursive), | 788 : recursive_(recursive), |
789 file_type_(file_type), | 789 file_type_(file_type), |
790 has_find_data_(false), | 790 has_find_data_(false), |
791 find_handle_(INVALID_HANDLE_VALUE) { | 791 find_handle_(INVALID_HANDLE_VALUE) { |
792 // INCLUDE_DOT_DOT must not be specified if recursive. | 792 // INCLUDE_DOT_DOT must not be specified if recursive. |
793 DCHECK(!(recursive && (INCLUDE_DOT_DOT & file_type_))); | 793 DCHECK(!(recursive && (INCLUDE_DOT_DOT & file_type_))); |
794 memset(&find_data_, 0, sizeof(find_data_)); | 794 memset(&find_data_, 0, sizeof(find_data_)); |
795 pending_paths_.push(root_path); | 795 pending_paths_.push(root_path); |
796 } | 796 } |
797 | 797 |
798 FileEnumerator::FileEnumerator(const FilePath& root_path, | 798 FileEnumerator::FileEnumerator(const FilePath& root_path, |
799 bool recursive, | 799 bool recursive, |
800 FileType file_type, | 800 int file_type, |
801 const FilePath::StringType& pattern) | 801 const FilePath::StringType& pattern) |
802 : recursive_(recursive), | 802 : recursive_(recursive), |
803 file_type_(file_type), | 803 file_type_(file_type), |
804 has_find_data_(false), | 804 has_find_data_(false), |
805 pattern_(pattern), | 805 pattern_(pattern), |
806 find_handle_(INVALID_HANDLE_VALUE) { | 806 find_handle_(INVALID_HANDLE_VALUE) { |
807 // INCLUDE_DOT_DOT must not be specified if recursive. | 807 // INCLUDE_DOT_DOT must not be specified if recursive. |
808 DCHECK(!(recursive && (INCLUDE_DOT_DOT & file_type_))); | 808 DCHECK(!(recursive && (INCLUDE_DOT_DOT & file_type_))); |
809 memset(&find_data_, 0, sizeof(find_data_)); | 809 memset(&find_data_, 0, sizeof(find_data_)); |
810 pending_paths_.push(root_path); | 810 pending_paths_.push(root_path); |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 HANDLE cp = GetCurrentProcess(); | 1107 HANDLE cp = GetCurrentProcess(); |
1108 if (::GetMappedFileNameW(cp, file_view, mapped_file_path, kMaxPathLength)) { | 1108 if (::GetMappedFileNameW(cp, file_view, mapped_file_path, kMaxPathLength)) { |
1109 *nt_path = FilePath(mapped_file_path); | 1109 *nt_path = FilePath(mapped_file_path); |
1110 success = true; | 1110 success = true; |
1111 } | 1111 } |
1112 ::UnmapViewOfFile(file_view); | 1112 ::UnmapViewOfFile(file_view); |
1113 return success; | 1113 return success; |
1114 } | 1114 } |
1115 | 1115 |
1116 } // namespace file_util | 1116 } // namespace file_util |
OLD | NEW |