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 /// A library for code coverage support for Dart. | 5 /// A library for code coverage support for Dart. |
6 library runtime.coverage.impl; | 6 library runtime.coverage.impl; |
7 | 7 |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:collection' show SplayTreeMap; | 9 import 'dart:collection' show SplayTreeMap; |
10 import 'dart:io'; | 10 import 'dart:io'; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 } | 114 } |
115 | 115 |
116 String getFilePath(Uri uri) { | 116 String getFilePath(Uri uri) { |
117 var path = uri.path; | 117 var path = uri.path; |
118 path = pathos.joinAll(uri.pathSegments); | 118 path = pathos.joinAll(uri.pathSegments); |
119 path = pathos.join(basePath, path); | 119 path = pathos.join(basePath, path); |
120 return pathos.normalize(path); | 120 return pathos.normalize(path); |
121 } | 121 } |
122 | 122 |
123 Future sendFile(HttpRequest request, File file) { | 123 Future sendFile(HttpRequest request, File file) { |
124 file.fullPath().then((fullPath) { | 124 file.resolveSymbolicLinks().then((fullPath) { |
125 return file.openRead().pipe(request.response); | 125 return file.openRead().pipe(request.response); |
126 }); | 126 }); |
127 } | 127 } |
128 | 128 |
129 bool shouldRewriteFile(String path); | 129 bool shouldRewriteFile(String path); |
130 | 130 |
131 /// Subclasses implement this method to rewrite the provided [code] of the | 131 /// Subclasses implement this method to rewrite the provided [code] of the |
132 /// file with [path]. Returns some content or `null` if file content | 132 /// file with [path]. Returns some content or `null` if file content |
133 /// should be requested. | 133 /// should be requested. |
134 String rewritePathContent(String path); | 134 String rewritePathContent(String path); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 var lastOffset = 0; | 332 var lastOffset = 0; |
333 offsetFragmentMap.forEach((offset, fragment) { | 333 offsetFragmentMap.forEach((offset, fragment) { |
334 sb.write(_code.substring(lastOffset, offset)); | 334 sb.write(_code.substring(lastOffset, offset)); |
335 sb.write(fragment); | 335 sb.write(fragment); |
336 lastOffset = offset; | 336 lastOffset = offset; |
337 }); | 337 }); |
338 sb.write(_code.substring(lastOffset, _code.length)); | 338 sb.write(_code.substring(lastOffset, _code.length)); |
339 return sb.toString(); | 339 return sb.toString(); |
340 } | 340 } |
341 } | 341 } |
OLD | NEW |