| Index: lib/src/utils.dart
|
| diff --git a/lib/src/utils.dart b/lib/src/utils.dart
|
| index 99902ada67a35ab67c300e29b33056ad9743450a..86c579901fc43172837ae3d4cc41544b0f6a2d91 100644
|
| --- a/lib/src/utils.dart
|
| +++ b/lib/src/utils.dart
|
| @@ -318,13 +318,17 @@ String resourceOutputPath(Uri resourceUri, Uri entryUri) {
|
| // assume this is a runtime resource from the dev_compiler.
|
| if (!relativePath.startsWith('..')) return relativePath;
|
|
|
| - // Expect the code to live under lib/runtime/ in the dev_compiler's folder.
|
| - var filename = path.basename(filepath);
|
| - var dir = path.dirname(filepath);
|
| - if (path.basename(dir) != 'runtime') return null;
|
| - dir = path.dirname(dir);
|
| - if (path.basename(dir) != 'lib') return null;
|
| - dir = path.dirname(dir);
|
| + // Since this is a URI path we can assume forward slash and use lastIndexOf.
|
| + var runtimePath = '/lib/runtime/';
|
| + var pos = filepath.lastIndexOf(runtimePath);
|
| + if (pos == -1) return null;
|
| +
|
| + var filename = filepath.substring(pos + runtimePath.length);
|
| + var dir = filepath.substring(0, pos);
|
| +
|
| + // TODO(jmesserly): can we implement this without repeatedly reading pubspec?
|
| + // It seems like we should know our package's root directory without needing
|
| + // to search like this.
|
| var pubspec =
|
| loadYaml(new File(path.join(dir, 'pubspec.yaml')).readAsStringSync());
|
|
|
|
|