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 vmservice_io; | 5 library vmservice_io; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 import 'dart:convert'; | 9 import 'dart:convert'; |
10 import 'dart:io'; | 10 import 'dart:io'; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 IOSink sink = await file.openWrite(); | 139 IOSink sink = await file.openWrite(); |
140 await sink.addStream(bytes); | 140 await sink.addStream(bytes); |
141 await sink.close(); | 141 await sink.close(); |
142 } | 142 } |
143 | 143 |
144 Future<List<int>> readFileCallback(Uri path) async { | 144 Future<List<int>> readFileCallback(Uri path) async { |
145 var file = new File.fromUri(path); | 145 var file = new File.fromUri(path); |
146 return await file.readAsBytes(); | 146 return await file.readAsBytes(); |
147 } | 147 } |
148 | 148 |
149 Future<List<Map<String,String>>> listFilesCallback(Uri dirPath) async { | 149 Future<List<Map<String, String>>> listFilesCallback(Uri dirPath) async { |
150 var dir = new Directory.fromUri(dirPath); | 150 var dir = new Directory.fromUri(dirPath); |
151 var dirPathStr = dirPath.path; | 151 var dirPathStr = dirPath.path; |
152 var stream = dir.list(recursive: true); | 152 var stream = dir.list(recursive: true); |
153 var result = []; | 153 var result = []; |
154 await for (var fileEntity in stream) { | 154 await for (var fileEntity in stream) { |
155 var filePath = new Uri.file(fileEntity.path).path; | 155 var filePath = new Uri.file(fileEntity.path).path; |
156 var stat = await fileEntity.stat(); | 156 var stat = await fileEntity.stat(); |
157 if (stat.type == FileSystemEntityType.FILE && | 157 if (stat.type == FileSystemEntityType.FILE && |
158 filePath.startsWith(dirPathStr)) { | 158 filePath.startsWith(dirPathStr)) { |
159 var map = {}; | 159 var map = {}; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 Timer.run(() {}); | 242 Timer.run(() {}); |
243 } | 243 } |
244 scriptLoadPort.handler = _processLoadRequest; | 244 scriptLoadPort.handler = _processLoadRequest; |
245 // Register signal handler after a small delay to avoid stalling main | 245 // Register signal handler after a small delay to avoid stalling main |
246 // isolate startup. | 246 // isolate startup. |
247 _registerSignalHandlerTimer = new Timer(shortDelay, _registerSignalHandler); | 247 _registerSignalHandlerTimer = new Timer(shortDelay, _registerSignalHandler); |
248 return scriptLoadPort; | 248 return scriptLoadPort; |
249 } | 249 } |
250 | 250 |
251 _shutdown() native "VMServiceIO_Shutdown"; | 251 _shutdown() native "VMServiceIO_Shutdown"; |
OLD | NEW |