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

Unified Diff: sdk/lib/io/platform_impl.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: 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
« sdk/lib/io/platform.dart ('K') | « sdk/lib/io/platform.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/platform_impl.dart
diff --git a/sdk/lib/io/platform_impl.dart b/sdk/lib/io/platform_impl.dart
index 6380e0d7c92f622495d3c9ca2149db2baafdfda9..f790b8c55e133b20cb15102b591a0517cac63266 100644
--- a/sdk/lib/io/platform_impl.dart
+++ b/sdk/lib/io/platform_impl.dart
@@ -21,7 +21,7 @@ class _Platform {
* a non-empty name and a value separated by a '=' character.
* The name does not contain a '=' character,
* so the name is everything up to the first '=' character.
- * Values are everything after the first '=' charcacter.
+ * Values are everything after the first '=' character.
* A value may contain further '=' characters, and it may be empty.
*
* Returns an [OSError] if retrieving the environment fails.
@@ -29,13 +29,31 @@ class _Platform {
external static _environment();
external static List<String> _executableArguments();
external static String _packageRoot();
+ external static _packageResolution();
external static String _version();
static String executable = _executable();
static String resolvedExecutable = _resolvedExecutable();
static String packageRoot = _packageRoot();
+ static var _resolution = () {
+ var res = _packageResolution();
+ // Do not give users access to the real map.
+ if (res is Map) res = new Map<String, Uri>.unmodifiable(res);
+ return res;
+ } ();
- // Cache the OS environemnt. This can be an OSError instance if
+ static Uri get packageRootUri {
+ if (_resolution is Uri) return _resolution;
Ivan Posva 2015/08/26 04:29:36 I'll implement these without going through native
Lasse Reichstein Nielsen 2015/08/26 06:26:06 That's fine. I'll just add the interface for now.
+ return null;
+ }
+
+ static Map<String, Uri> get packageMap {
+ if (_resolution is Map) return _resolution;
+ if (_resolution == null) return const <String, Uri>{};
+ return null;
+ }
+
+ // Cache the OS environment. This can be an OSError instance if
// retrieving the environment failed.
static var _environmentCache;
« sdk/lib/io/platform.dart ('K') | « sdk/lib/io/platform.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698