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

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

Issue 1334353002: - Add getters for the current packageRoot or packageMap. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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
Index: sdk/lib/io/platform.dart
diff --git a/sdk/lib/io/platform.dart b/sdk/lib/io/platform.dart
index 56ddea0193b0df98b43e703e0c98828f4eb1e696..345d61083ad3b67b2884f83998d42e3c9d7f3a2c 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 Future<Uri> get packageRoot => _Platform.packageRoot;
+
+ /**
+ * 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.
Lasse Reichstein Nielsen 2015/09/14 12:56:09 Change to: The package map maps recognized packa
siva 2015/09/14 18:12:07 The comment seems a bit hard to read maybe : The p
Lasse Reichstein Nielsen 2015/09/15 07:49:53 I'm not sure how to parse that.
Ivan Posva 2015/09/22 09:42:30 Lasse and I agreed on the following wording: The
+ *
+ * Returns an empty map if the isolate does not have a way to resolve package
+ * URIs.
+ */
+ static Future<Map<String, Uri>> get packageMap => _Platform.packageMap;
/**
* Returns the version of the current Dart runtime.

Powered by Google App Engine
This is Rietveld 408576698