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 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 base::ThreadRestrictions::AssertIOAllowed(); | 792 base::ThreadRestrictions::AssertIOAllowed(); |
793 BOOL ret = ::SetCurrentDirectory(directory.value().c_str()); | 793 BOOL ret = ::SetCurrentDirectory(directory.value().c_str()); |
794 return ret != 0; | 794 return ret != 0; |
795 } | 795 } |
796 | 796 |
797 /////////////////////////////////////////////// | 797 /////////////////////////////////////////////// |
798 // FileEnumerator | 798 // FileEnumerator |
799 | 799 |
800 FileEnumerator::FileEnumerator(const FilePath& root_path, | 800 FileEnumerator::FileEnumerator(const FilePath& root_path, |
801 bool recursive, | 801 bool recursive, |
802 FileType file_type) | 802 int file_type) |
803 : recursive_(recursive), | 803 : recursive_(recursive), |
804 file_type_(file_type), | 804 file_type_(file_type), |
805 has_find_data_(false), | 805 has_find_data_(false), |
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); |
811 } | 811 } |
812 | 812 |
813 FileEnumerator::FileEnumerator(const FilePath& root_path, | 813 FileEnumerator::FileEnumerator(const FilePath& root_path, |
814 bool recursive, | 814 bool recursive, |
815 FileType file_type, | 815 int file_type, |
816 const FilePath::StringType& pattern) | 816 const FilePath::StringType& pattern) |
817 : recursive_(recursive), | 817 : recursive_(recursive), |
818 file_type_(file_type), | 818 file_type_(file_type), |
819 has_find_data_(false), | 819 has_find_data_(false), |
820 pattern_(pattern), | 820 pattern_(pattern), |
821 find_handle_(INVALID_HANDLE_VALUE) { | 821 find_handle_(INVALID_HANDLE_VALUE) { |
822 // INCLUDE_DOT_DOT must not be specified if recursive. | 822 // INCLUDE_DOT_DOT must not be specified if recursive. |
823 DCHECK(!(recursive && (INCLUDE_DOT_DOT & file_type_))); | 823 DCHECK(!(recursive && (INCLUDE_DOT_DOT & file_type_))); |
824 memset(&find_data_, 0, sizeof(find_data_)); | 824 memset(&find_data_, 0, sizeof(find_data_)); |
825 pending_paths_.push(root_path); | 825 pending_paths_.push(root_path); |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 HANDLE cp = GetCurrentProcess(); | 1122 HANDLE cp = GetCurrentProcess(); |
1123 if (::GetMappedFileNameW(cp, file_view, mapped_file_path, kMaxPathLength)) { | 1123 if (::GetMappedFileNameW(cp, file_view, mapped_file_path, kMaxPathLength)) { |
1124 *nt_path = FilePath(mapped_file_path); | 1124 *nt_path = FilePath(mapped_file_path); |
1125 success = true; | 1125 success = true; |
1126 } | 1126 } |
1127 ::UnmapViewOfFile(file_view); | 1127 ::UnmapViewOfFile(file_view); |
1128 return success; | 1128 return success; |
1129 } | 1129 } |
1130 | 1130 |
1131 } // namespace file_util | 1131 } // namespace file_util |
OLD | NEW |