| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 dev_compiler.src.multi_package_resolver; | |
| 6 | |
| 7 import 'dart:io'; | 5 import 'dart:io'; |
| 8 | 6 |
| 9 import 'package:analyzer/src/generated/java_io.dart'; | 7 import 'package:analyzer/src/generated/java_io.dart'; |
| 10 import 'package:analyzer/src/generated/source.dart'; | 8 import 'package:analyzer/src/generated/source.dart'; |
| 11 import 'package:analyzer/src/generated/source_io.dart'; | 9 import 'package:analyzer/src/generated/source_io.dart'; |
| 12 import 'package:path/path.dart' show join; | 10 import 'package:path/path.dart' show join; |
| 13 | 11 |
| 14 /// A package resolver that supports a non-standard package layout, where | 12 /// A package resolver that supports a non-standard package layout, where |
| 15 /// packages with dotted names are expanded to a hierarchy of directories, and | 13 /// packages with dotted names are expanded to a hierarchy of directories, and |
| 16 /// packages can be found on one or more locations. | 14 /// packages can be found on one or more locations. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 46 /// Expand `uri.path`, replacing dots in the package name with slashes. | 44 /// Expand `uri.path`, replacing dots in the package name with slashes. |
| 47 List<String> _expandPath(Uri uri) { | 45 List<String> _expandPath(Uri uri) { |
| 48 if (uri.scheme != 'package') return null; | 46 if (uri.scheme != 'package') return null; |
| 49 var path = uri.path; | 47 var path = uri.path; |
| 50 var slashPos = path.indexOf('/'); | 48 var slashPos = path.indexOf('/'); |
| 51 var packagePath = path.substring(0, slashPos).replaceAll(".", "/"); | 49 var packagePath = path.substring(0, slashPos).replaceAll(".", "/"); |
| 52 var filePath = path.substring(slashPos + 1); | 50 var filePath = path.substring(slashPos + 1); |
| 53 return ['$packagePath/lib/$filePath', '$packagePath/$filePath']; | 51 return ['$packagePath/lib/$filePath', '$packagePath/$filePath']; |
| 54 } | 52 } |
| 55 } | 53 } |
| OLD | NEW |