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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 if (FindNextFileW(reinterpret_cast<HANDLE>(lister_), &find_file_data) != 0) { | 199 if (FindNextFileW(reinterpret_cast<HANDLE>(lister_), &find_file_data) != 0) { |
200 return HandleFindFile(listing, this, find_file_data); | 200 return HandleFindFile(listing, this, find_file_data); |
201 } | 201 } |
202 | 202 |
203 done_ = true; | 203 done_ = true; |
204 | 204 |
205 if (GetLastError() != ERROR_NO_MORE_FILES) { | 205 if (GetLastError() != ERROR_NO_MORE_FILES) { |
206 return kListError; | 206 return kListError; |
207 } | 207 } |
208 | 208 |
209 if (FindClose(reinterpret_cast<HANDLE>(lister_)) == 0) { | |
210 return kListError; | |
211 } | |
212 | |
213 return kListDone; | 209 return kListDone; |
214 } | 210 } |
215 | 211 |
216 | 212 |
| 213 DirectoryListingEntry::~DirectoryListingEntry() { |
| 214 ResetLink(); |
| 215 if (lister_ != 0) { |
| 216 FindClose(reinterpret_cast<HANDLE>(lister_)); |
| 217 } |
| 218 } |
| 219 |
| 220 |
217 void DirectoryListingEntry::ResetLink() { | 221 void DirectoryListingEntry::ResetLink() { |
218 if (link_ != NULL && (parent_ == NULL || parent_->link_ != link_)) { | 222 if (link_ != NULL && (parent_ == NULL || parent_->link_ != link_)) { |
219 delete link_; | 223 delete link_; |
220 link_ = NULL; | 224 link_ = NULL; |
221 } | 225 } |
222 if (parent_ != NULL) { | 226 if (parent_ != NULL) { |
223 link_ = parent_->link_; | 227 link_ = parent_->link_; |
224 } | 228 } |
225 } | 229 } |
226 | 230 |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 MoveFileExW(system_path, system_new_path, flags); | 470 MoveFileExW(system_path, system_new_path, flags); |
467 free(const_cast<wchar_t*>(system_path)); | 471 free(const_cast<wchar_t*>(system_path)); |
468 free(const_cast<wchar_t*>(system_new_path)); | 472 free(const_cast<wchar_t*>(system_new_path)); |
469 return (move_status != 0); | 473 return (move_status != 0); |
470 } | 474 } |
471 | 475 |
472 } // namespace bin | 476 } // namespace bin |
473 } // namespace dart | 477 } // namespace dart |
474 | 478 |
475 #endif // defined(TARGET_OS_WINDOWS) | 479 #endif // defined(TARGET_OS_WINDOWS) |
OLD | NEW |