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

Unified Diff: sdk/lib/io/platform.dart

Issue 1307183002: Add access to the isolate package-root/package-map in Platform. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: replace packageRoot getter, remove C++ imp. Created 5 years, 4 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 | « runtime/bin/platform_patch.dart ('k') | sdk/lib/io/platform_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/platform.dart
diff --git a/sdk/lib/io/platform.dart b/sdk/lib/io/platform.dart
index 56ddea0193b0df98b43e703e0c98828f4eb1e696..cbdb016c0fd482edaa6be3adc7f84ba99c77bc19 100644
--- a/sdk/lib/io/platform.dart
+++ b/sdk/lib/io/platform.dart
@@ -176,13 +176,27 @@ class Platform {
static List<String> get executableArguments => _Platform.executableArguments;
/**
- * Returns the value of the --package-root flag passed to the executable
- * used to run the script in this isolate. This is the directory in which
- * Dart packages are looked up.
+ * Returns the package root of the current isolate, if any.
*
- * If there is no --package-root flag, then the empty string is returned.
+ * If the isolate is using a [packageMap], this getter returns `null`,
+ * otherwise it returns the package root - a directory that package
+ * URIs are resolved against.
*/
- static String get packageRoot => _Platform.packageRoot;
+ static Uri get packageRoot => _Platform.packageRootUri;
+
+ /**
+ * Returns the package mapping of the current isolate, if any.
+ *
+ * If the current isolate is using [packageRoot], this getter returns `null`.
+ *
+ * The package map maps package names to a directory that package URIs for
+ * that package are resolved against, or to `null`, if the package name is
+ * not recognized.
+ *
+ * Returns an empty map if the isolate does not have a way to resolve package
+ * URIs.
+ */
+ static Map<String, Uri> get packageMap => _Platform.packageMap;
/**
* Returns the version of the current Dart runtime.
« no previous file with comments | « runtime/bin/platform_patch.dart ('k') | sdk/lib/io/platform_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698