OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "platform/globals.h" | 5 #include "platform/globals.h" |
6 #if defined(TARGET_OS_WINDOWS) | 6 #if defined(TARGET_OS_WINDOWS) |
7 | 7 |
8 #include "bin/directory.h" | 8 #include "bin/directory.h" |
9 #include "bin/file.h" | 9 #include "bin/file.h" |
10 #include "bin/utils.h" | 10 #include "bin/utils.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 } | 163 } |
164 | 164 |
165 ListType DirectoryListingEntry::Next(DirectoryListing* listing) { | 165 ListType DirectoryListingEntry::Next(DirectoryListing* listing) { |
166 if (done_) { | 166 if (done_) { |
167 return kListDone; | 167 return kListDone; |
168 } | 168 } |
169 | 169 |
170 WIN32_FIND_DATAW find_file_data; | 170 WIN32_FIND_DATAW find_file_data; |
171 | 171 |
172 if (lister_ == 0) { | 172 if (lister_ == 0) { |
173 if (!listing->path_buffer().AddW(L"\\*")) { | 173 if (!listing->path_buffer().AddW(L"*")) { |
174 done_ = true; | 174 done_ = true; |
175 return kListError; | 175 return kListError; |
176 } | 176 } |
177 | 177 |
178 path_length_ = listing->path_buffer().length() - 1; | 178 path_length_ = listing->path_buffer().length() - 1; |
179 | 179 |
180 HANDLE find_handle = FindFirstFileW(listing->path_buffer().AsStringW(), | 180 HANDLE find_handle = FindFirstFileW(listing->path_buffer().AsStringW(), |
181 &find_file_data); | 181 &find_file_data); |
182 | 182 |
183 if (find_handle == INVALID_HANDLE_VALUE) { | 183 if (find_handle == INVALID_HANDLE_VALUE) { |
184 done_ = true; | 184 done_ = true; |
185 return kListError; | 185 return kListError; |
186 } | 186 } |
187 | 187 |
188 lister_ = reinterpret_cast<intptr_t>(find_handle); | 188 lister_ = reinterpret_cast<intptr_t>(find_handle); |
189 | 189 |
| 190 if (parent_ != NULL) { |
| 191 if (!listing->path_buffer().AddW(L"\\")) { |
| 192 return kListError; |
| 193 } |
| 194 } |
| 195 |
190 listing->path_buffer().Reset(path_length_); | 196 listing->path_buffer().Reset(path_length_); |
191 | 197 |
192 return HandleFindFile(listing, this, find_file_data); | 198 return HandleFindFile(listing, this, find_file_data); |
193 } | 199 } |
194 | 200 |
195 // Reset. | 201 // Reset. |
196 listing->path_buffer().Reset(path_length_); | 202 listing->path_buffer().Reset(path_length_); |
197 ResetLink(); | 203 ResetLink(); |
198 | 204 |
199 if (FindNextFileW(reinterpret_cast<HANDLE>(lister_), &find_file_data) != 0) { | 205 if (FindNextFileW(reinterpret_cast<HANDLE>(lister_), &find_file_data) != 0) { |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 MoveFileExW(system_path, system_new_path, flags); | 476 MoveFileExW(system_path, system_new_path, flags); |
471 free(const_cast<wchar_t*>(system_path)); | 477 free(const_cast<wchar_t*>(system_path)); |
472 free(const_cast<wchar_t*>(system_new_path)); | 478 free(const_cast<wchar_t*>(system_new_path)); |
473 return (move_status != 0); | 479 return (move_status != 0); |
474 } | 480 } |
475 | 481 |
476 } // namespace bin | 482 } // namespace bin |
477 } // namespace dart | 483 } // namespace dart |
478 | 484 |
479 #endif // defined(TARGET_OS_WINDOWS) | 485 #endif // defined(TARGET_OS_WINDOWS) |
OLD | NEW |