| 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 "bin/directory.h" | 5 #include "bin/directory.h" |
| 6 | 6 |
| 7 #include "bin/dartutils.h" | 7 #include "bin/dartutils.h" |
| 8 #include "bin/thread.h" | 8 #include "bin/thread.h" |
| 9 #include "include/dart_api.h" | 9 #include "include/dart_api.h" |
| 10 #include "platform/assert.h" | 10 #include "platform/assert.h" |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 return true; | 367 return true; |
| 368 } | 368 } |
| 369 | 369 |
| 370 bool SyncDirectoryListing::HandleError(const char* dir_name) { | 370 bool SyncDirectoryListing::HandleError(const char* dir_name) { |
| 371 Dart_Handle dart_os_error = DartUtils::NewDartOSError(); | 371 Dart_Handle dart_os_error = DartUtils::NewDartOSError(); |
| 372 Dart_Handle args[3]; | 372 Dart_Handle args[3]; |
| 373 args[0] = DartUtils::NewString("Directory listing failed"); | 373 args[0] = DartUtils::NewString("Directory listing failed"); |
| 374 args[1] = DartUtils::NewString(dir_name); | 374 args[1] = DartUtils::NewString(dir_name); |
| 375 args[2] = dart_os_error; | 375 args[2] = dart_os_error; |
| 376 Dart_ThrowException(Dart_New( | 376 Dart_ThrowException(Dart_New( |
| 377 DartUtils::GetDartType(DartUtils::kIOLibURL, "DirectoryException"), | 377 DartUtils::GetDartType(DartUtils::kIOLibURL, "FileSystemException"), |
| 378 Dart_Null(), | 378 Dart_Null(), |
| 379 3, | 379 3, |
| 380 args)); | 380 args)); |
| 381 return true; | 381 return true; |
| 382 } | 382 } |
| 383 | 383 |
| 384 | 384 |
| 385 static bool ListNext(DirectoryListing* listing) { | 385 static bool ListNext(DirectoryListing* listing) { |
| 386 switch (listing->top()->Next(listing)) { | 386 switch (listing->top()->Next(listing)) { |
| 387 case kListFile: | 387 case kListFile: |
| (...skipping 30 matching lines...) Expand all Loading... |
| 418 if (listing->error()) { | 418 if (listing->error()) { |
| 419 listing->HandleError("Invalid path"); | 419 listing->HandleError("Invalid path"); |
| 420 listing->HandleDone(); | 420 listing->HandleDone(); |
| 421 } else { | 421 } else { |
| 422 while (ListNext(listing)) {} | 422 while (ListNext(listing)) {} |
| 423 } | 423 } |
| 424 } | 424 } |
| 425 | 425 |
| 426 } // namespace bin | 426 } // namespace bin |
| 427 } // namespace dart | 427 } // namespace dart |
| OLD | NEW |