Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Side by Side Diff: runtime/bin/directory_win.cc

Issue 131403002: Fix Windows impl. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 wchar_t tail = parent_ == NULL ? L"*" : L"\\*";
174 if (!listing->path_buffer().AddW(tail)) {
174 done_ = true; 175 done_ = true;
175 return kListError; 176 return kListError;
176 } 177 }
177 178
178 path_length_ = listing->path_buffer().length() - 1; 179 path_length_ = listing->path_buffer().length() - 1;
179 180
180 HANDLE find_handle = FindFirstFileW(listing->path_buffer().AsStringW(), 181 HANDLE find_handle = FindFirstFileW(listing->path_buffer().AsStringW(),
181 &find_file_data); 182 &find_file_data);
182 183
183 if (find_handle == INVALID_HANDLE_VALUE) { 184 if (find_handle == INVALID_HANDLE_VALUE) {
184 done_ = true; 185 done_ = true;
185 return kListError; 186 return kListError;
186 } 187 }
187 188
188 lister_ = reinterpret_cast<intptr_t>(find_handle); 189 lister_ = reinterpret_cast<intptr_t>(find_handle);
189 190
190 if (parent_ != NULL) {
191 if (!listing->path_buffer().AddW(L"\\")) {
192 return kListError;
193 }
194 }
195
196 listing->path_buffer().Reset(path_length_); 191 listing->path_buffer().Reset(path_length_);
197 192
198 return HandleFindFile(listing, this, find_file_data); 193 return HandleFindFile(listing, this, find_file_data);
199 } 194 }
200 195
201 // Reset. 196 // Reset.
202 listing->path_buffer().Reset(path_length_); 197 listing->path_buffer().Reset(path_length_);
203 ResetLink(); 198 ResetLink();
204 199
205 if (FindNextFileW(reinterpret_cast<HANDLE>(lister_), &find_file_data) != 0) { 200 if (FindNextFileW(reinterpret_cast<HANDLE>(lister_), &find_file_data) != 0) {
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 MoveFileExW(system_path, system_new_path, flags); 471 MoveFileExW(system_path, system_new_path, flags);
477 free(const_cast<wchar_t*>(system_path)); 472 free(const_cast<wchar_t*>(system_path));
478 free(const_cast<wchar_t*>(system_new_path)); 473 free(const_cast<wchar_t*>(system_new_path));
479 return (move_status != 0); 474 return (move_status != 0);
480 } 475 }
481 476
482 } // namespace bin 477 } // namespace bin
483 } // namespace dart 478 } // namespace dart
484 479
485 #endif // defined(TARGET_OS_WINDOWS) 480 #endif // defined(TARGET_OS_WINDOWS)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698