| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 var file = await new File.fromUri(path); | 79 var file = await new File.fromUri(path); |
| 80 return await file.readAsBytes(); | 80 return await file.readAsBytes(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 Future<List<Map<String,String>>> listFilesCallback(Uri dirPath) async { | 83 Future<List<Map<String,String>>> listFilesCallback(Uri dirPath) async { |
| 84 var dir = new Directory.fromUri(dirPath); | 84 var dir = new Directory.fromUri(dirPath); |
| 85 var dirPathStr = dirPath.path; | 85 var dirPathStr = dirPath.path; |
| 86 var stream = dir.list(recursive: true); | 86 var stream = dir.list(recursive: true); |
| 87 var result = []; | 87 var result = []; |
| 88 await for (var fileEntity in stream) { | 88 await for (var fileEntity in stream) { |
| 89 var filePath = new Uri.file(fileEntity.path).path; |
| 89 var stat = await fileEntity.stat(); | 90 var stat = await fileEntity.stat(); |
| 90 if (stat.type == FileSystemEntityType.FILE && | 91 if (stat.type == FileSystemEntityType.FILE && |
| 91 fileEntity.path.startsWith(dirPathStr)) { | 92 filePath.startsWith(dirPathStr)) { |
| 92 var map = {}; | 93 var map = {}; |
| 93 map['name'] = '/' + fileEntity.path.substring(dirPathStr.length); | 94 map['name'] = '/' + filePath.substring(dirPathStr.length); |
| 94 map['size'] = stat.size; | 95 map['size'] = stat.size; |
| 95 map['modified'] = stat.modified.millisecondsSinceEpoch; | 96 map['modified'] = stat.modified.millisecondsSinceEpoch; |
| 96 result.add(map); | 97 result.add(map); |
| 97 } | 98 } |
| 98 } | 99 } |
| 99 return result; | 100 return result; |
| 100 } | 101 } |
| 101 | 102 |
| 102 _clearFuture(_) { | 103 _clearFuture(_) { |
| 103 serverFuture = null; | 104 serverFuture = null; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 Timer.run(() {}); | 152 Timer.run(() {}); |
| 152 } | 153 } |
| 153 scriptLoadPort.handler = _processLoadRequest; | 154 scriptLoadPort.handler = _processLoadRequest; |
| 154 // Register signal handler after a small delay to avoid stalling main | 155 // Register signal handler after a small delay to avoid stalling main |
| 155 // isolate startup. | 156 // isolate startup. |
| 156 _registerSignalHandlerTimer = new Timer(shortDelay, _registerSignalHandler); | 157 _registerSignalHandlerTimer = new Timer(shortDelay, _registerSignalHandler); |
| 157 return scriptLoadPort; | 158 return scriptLoadPort; |
| 158 } | 159 } |
| 159 | 160 |
| 160 _shutdown() native "VMServiceIO_Shutdown"; | 161 _shutdown() native "VMServiceIO_Shutdown"; |
| OLD | NEW |