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/test/test_file_util.h" | 5 #include "base/test/test_file_util.h" |
6 | 6 |
7 #include <aclapi.h> | 7 #include <aclapi.h> |
8 #include <shlwapi.h> | 8 #include <shlwapi.h> |
9 #include <windows.h> | 9 #include <windows.h> |
10 | 10 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 bool CopyRecursiveDirNoCache(const FilePath& source_dir, | 169 bool CopyRecursiveDirNoCache(const FilePath& source_dir, |
170 const FilePath& dest_dir) { | 170 const FilePath& dest_dir) { |
171 // Try to create the directory if it doesn't already exist. | 171 // Try to create the directory if it doesn't already exist. |
172 if (!CreateDirectory(dest_dir)) { | 172 if (!CreateDirectory(dest_dir)) { |
173 if (GetLastError() != ERROR_ALREADY_EXISTS) | 173 if (GetLastError() != ERROR_ALREADY_EXISTS) |
174 return false; | 174 return false; |
175 } | 175 } |
176 | 176 |
177 std::vector<std::wstring> files_copied; | 177 std::vector<std::wstring> files_copied; |
178 | 178 |
179 std::wstring src(source_dir.value()); | 179 FilePath src(source_dir.AppendASCII("*")); |
180 file_util::AppendToPath(&src, L"*"); | |
181 | 180 |
182 WIN32_FIND_DATA fd; | 181 WIN32_FIND_DATA fd; |
183 HANDLE fh = FindFirstFile(src.c_str(), &fd); | 182 HANDLE fh = FindFirstFile(src.value().c_str(), &fd); |
184 if (fh == INVALID_HANDLE_VALUE) | 183 if (fh == INVALID_HANDLE_VALUE) |
185 return false; | 184 return false; |
186 | 185 |
187 do { | 186 do { |
188 std::wstring cur_file(fd.cFileName); | 187 std::wstring cur_file(fd.cFileName); |
189 if (cur_file == L"." || cur_file == L"..") | 188 if (cur_file == L"." || cur_file == L"..") |
190 continue; // Skip these special entries. | 189 continue; // Skip these special entries. |
191 | 190 |
192 FilePath cur_source_path = source_dir.Append(cur_file); | 191 FilePath cur_source_path = source_dir.Append(cur_file); |
193 FilePath cur_dest_path = dest_dir.Append(cur_file); | 192 FilePath cur_dest_path = dest_dir.Append(cur_file); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 | 271 |
273 bool MakeFileUnreadable(const FilePath& path) { | 272 bool MakeFileUnreadable(const FilePath& path) { |
274 return DenyFilePermission(path, GENERIC_READ); | 273 return DenyFilePermission(path, GENERIC_READ); |
275 } | 274 } |
276 | 275 |
277 bool MakeFileUnwritable(const FilePath& path) { | 276 bool MakeFileUnwritable(const FilePath& path) { |
278 return DenyFilePermission(path, GENERIC_WRITE); | 277 return DenyFilePermission(path, GENERIC_WRITE); |
279 } | 278 } |
280 | 279 |
281 } // namespace file_util | 280 } // namespace file_util |
OLD | NEW |