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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.io; 5 part of dart.io;
6 6
7 /** 7 /**
8 * Information about the environment in which the current program is running. 8 * Information about the environment in which the current program is running.
9 * 9 *
10 * Platform provides information such as the operating system, 10 * Platform provides information such as the operating system,
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 169
170 /** 170 /**
171 * Returns the flags passed to the executable used to run the script in this 171 * Returns the flags passed to the executable used to run the script in this
172 * isolate. These are the command-line flags between the executable name 172 * isolate. These are the command-line flags between the executable name
173 * and the script name. Each fetch of executableArguments returns a new 173 * and the script name. Each fetch of executableArguments returns a new
174 * List, containing the flags passed to the executable. 174 * List, containing the flags passed to the executable.
175 */ 175 */
176 static List<String> get executableArguments => _Platform.executableArguments; 176 static List<String> get executableArguments => _Platform.executableArguments;
177 177
178 /** 178 /**
179 * Returns the value of the --package-root flag passed to the executable 179 * Returns the package root of the current isolate, if any.
180 * used to run the script in this isolate. This is the directory in which
181 * Dart packages are looked up.
182 * 180 *
183 * If there is no --package-root flag, then the empty string is returned. 181 * If the isolate is using a [packageMap], this getter returns `null`,
182 * otherwise it returns the package root - a directory that package
183 * URIs are resolved against.
184 */ 184 */
185 static String get packageRoot => _Platform.packageRoot; 185 static Future<Uri> get packageRoot => _Platform.packageRoot;
186
187 /**
188 * Returns the package mapping of the current isolate, if any.
189 *
190 * If the current isolate is using [packageRoot], this getter returns `null`.
191 *
192 * The package map maps package names to a directory that package URIs for
193 * that package are resolved against, or to `null`, if the package name is
194 * 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
195 *
196 * Returns an empty map if the isolate does not have a way to resolve package
197 * URIs.
198 */
199 static Future<Map<String, Uri>> get packageMap => _Platform.packageMap;
186 200
187 /** 201 /**
188 * Returns the version of the current Dart runtime. 202 * Returns the version of the current Dart runtime.
189 * 203 *
190 * The returned `String` is formatted as the 204 * The returned `String` is formatted as the
191 * [semver](http://semver.org) version string of the current dart 205 * [semver](http://semver.org) version string of the current dart
192 * runtime, possibly followed by whitespace and other version and 206 * runtime, possibly followed by whitespace and other version and
193 * build details. 207 * build details.
194 */ 208 */
195 static String get version => _version; 209 static String get version => _version;
196 } 210 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698