OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import "dart:async"; | 5 import "dart:async"; |
6 import "dart:io"; | 6 import "dart:io"; |
7 import "dart:convert" show JSON; | 7 import "dart:convert" show JSON; |
8 import "package:path/path.dart" as p; | 8 import "package:path/path.dart" as p; |
9 import "package:async_helper/async_helper.dart"; | 9 import "package:async_helper/async_helper.dart"; |
10 | 10 |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 // value of these, you can only change what value to expect. | 289 // value of these, you can only change what value to expect. |
290 // For values not included here (commented out), the result is not tested | 290 // For values not included here (commented out), the result is not tested |
291 // unless a value (maybe null) is provided. | 291 // unless a value (maybe null) is provided. |
292 fixPaths(expect); | 292 fixPaths(expect); |
293 | 293 |
294 expect = { | 294 expect = { |
295 "pconf": null, | 295 "pconf": null, |
296 "proot": null, | 296 "proot": null, |
297 "iconf": null, | 297 "iconf": null, |
298 "iroot": null, | 298 "iroot": null, |
299 "foo": null, | 299 // "foo": null, |
300 "foo/": null, | 300 "foo/": null, |
301 "foo/bar": null, | 301 "foo/bar": null, |
302 "foo.x": "qux", | 302 "foo.x": "qux", |
303 "bar/bar": null, | 303 "bar/bar": null, |
304 "relative": "relative/path", | 304 "relative": "relative/path", |
305 "nonpkg": "http://example.org/file" | 305 "nonpkg": "http://example.org/file" |
306 }..addAll(expect ?? const {}); | 306 }..addAll(expect ?? const {}); |
307 | 307 |
308 // Add http files to the http server. | 308 // Add http files to the http server. |
309 if (http.isNotEmpty) { | 309 if (http.isNotEmpty) { |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
984 void insertFileAt(Map file, Map http, | 984 void insertFileAt(Map file, Map http, |
985 String path, String name, String content) { | 985 String path, String name, String content) { |
986 var parts = path.split('/').toList(); | 986 var parts = path.split('/').toList(); |
987 var dir = (parts[0] == "%file") ? file : http; | 987 var dir = (parts[0] == "%file") ? file : http; |
988 for (var i = 1; i < parts.length - 1; i++) { | 988 for (var i = 1; i < parts.length - 1; i++) { |
989 var entry = parts[i]; | 989 var entry = parts[i]; |
990 dir = dir[entry] ?? (dir[entry] = {}); | 990 dir = dir[entry] ?? (dir[entry] = {}); |
991 } | 991 } |
992 dir[name] = content; | 992 dir[name] = content; |
993 } | 993 } |
OLD | NEW |