Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(573)

Unified Diff: lib/src/utils.dart

Issue 1020043002: Replace dart_core.js with actual compiled SDK (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: merge Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/options.dart ('k') | test/codegen/expect/constructors.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « lib/src/options.dart ('k') | test/codegen/expect/constructors.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698