Chromium Code Reviews| Index: lib/src/utils.dart |
| diff --git a/lib/src/utils.dart b/lib/src/utils.dart |
| index dd62656ddfa875dfc0f7bd617775b75237a0ab04..0c286f3033b207a01157f4b4162941ef8d1640b5 100644 |
| --- a/lib/src/utils.dart |
| +++ b/lib/src/utils.dart |
| @@ -316,15 +316,21 @@ String resourceOutputPath(Uri resourceUri, Uri entryUri) { |
| // further inside the folder where the entrypoint is located, otherwise we |
| // assume this is a runtime resource from the dev_compiler. |
| if (!relativePath.startsWith('..')) return relativePath; |
| + |
| var segments = resourceUri.pathSegments; |
| - var len = segments.length; |
| - if (segments.length < 4 || |
| - segments[len - 2] != 'runtime' || |
| - segments[len - 3] != 'lib' || |
| - // If loaded from sources this will be exactly dev_compiler, otherwise it |
| - // can be the name in the pub cache (typically dev_compiler-version). |
| - !segments[len - 4].startsWith('dev_compiler')) { |
| - return null; |
| + for (int i = 0, len = segments.length; i < len; i++) { |
| + var s = segments[i]; |
| + if (_packageNameWithVersion.stringMatch(s) == s && |
|
Siggi Cherem (dart-lang)
2015/03/19 23:11:14
FYI you'll have a not so fun merge conflict here :
|
| + i + 3 < len && |
| + segments[i + 1] == 'lib' && |
| + segments[i + 2] == 'runtime') { |
| + return path.joinAll(['dev_compiler']..addAll(segments.skip(i + 2))); |
| + } |
| } |
| - return path.joinAll(['dev_compiler']..addAll(segments.skip(len - 2))); |
| + return null; |
| } |
| + |
| +// If loaded from sources this will be exactly dev_compiler, otherwise it |
| +// can be the name in the pub cache (typically dev_compiler-version). |
| +// TODO(jmesserly): avoid depending on pub cache implementation details. |
| +final _packageNameWithVersion = new RegExp('dev_compiler[0-9A-Za-z-.]*'); |