OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library descriptor_test; | 5 library descriptor_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 import '../../../pkg/pathos/lib/path.dart' as path; | 10 import '../../../pkg/pathos/lib/path.dart' as path; |
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 sandbox = dir.path; | 951 sandbox = dir.path; |
952 d.defaultRoot = sandbox; | 952 d.defaultRoot = sandbox; |
953 }); | 953 }); |
954 }); | 954 }); |
955 | 955 |
956 currentSchedule.onComplete.schedule(() { | 956 currentSchedule.onComplete.schedule(() { |
957 d.defaultRoot = null; | 957 d.defaultRoot = null; |
958 if (sandbox == null) return; | 958 if (sandbox == null) return; |
959 var oldSandbox = sandbox; | 959 var oldSandbox = sandbox; |
960 sandbox = null; | 960 sandbox = null; |
961 return deleteDir(oldSandbox); | 961 return new Directory(oldSandbox).delete(recursive: true); |
962 }); | 962 }); |
963 } | 963 } |
964 | 964 |
965 Future<List<int>> byteStreamToList(Stream<List<int>> stream) { | 965 Future<List<int>> byteStreamToList(Stream<List<int>> stream) { |
966 return stream.reduce(<int>[], (buffer, chunk) { | 966 return stream.reduce(<int>[], (buffer, chunk) { |
967 buffer.addAll(chunk); | 967 buffer.addAll(chunk); |
968 return buffer; | 968 return buffer; |
969 }); | 969 }); |
970 } | 970 } |
971 | 971 |
972 Future<String> byteStreamToString(Stream<List<int>> stream) => | 972 Future<String> byteStreamToString(Stream<List<int>> stream) => |
973 byteStreamToList(stream).then((bytes) => new String.fromCharCodes(bytes)); | 973 byteStreamToList(stream).then((bytes) => new String.fromCharCodes(bytes)); |
OLD | NEW |