Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 value of the --package-root flag passed to the executable |
| 180 * used to run the script in this isolate. This is the directory in which | 180 * used to run the script in this isolate. This is the directory in which |
| 181 * Dart packages are looked up. | 181 * Dart packages are looked up. |
| 182 * | 182 * |
| 183 * If there is no --package-root flag, then the empty string is returned. | 183 * If there is no --package-root flag, then the empty string is returned. |
|
floitsch
2015/08/24 15:09:45
should that one also return null in case of a pack
Lasse Reichstein Nielsen
2015/08/25 06:23:00
Not touching existing functionality. That could be
Ivan Posva
2015/08/26 04:29:36
To be honest we should consider making this breaki
Lasse Reichstein Nielsen
2015/08/26 06:26:06
I'm all for breaking, in which case packageRoot sh
| |
| 184 */ | 184 */ |
| 185 static String get packageRoot => _Platform.packageRoot; | 185 static String get packageRoot => _Platform.packageRoot; |
| 186 | 186 |
| 187 /** | 187 /** |
| 188 * Returns the package root of the current isolate, if any. | |
| 189 * | |
| 190 * If the isolate is using a [packageMap], this getter returns `null`, | |
|
Ivan Posva
2015/08/26 04:29:36
This is not entirely correct: An isolate might not
Lasse Reichstein Nielsen
2015/08/26 06:26:06
Again, I'm trying to keep things simpler by saying
| |
| 191 * otherwise it returns the package root - a directory that package | |
| 192 * URIs are resolved against. | |
|
nweiz
2015/08/25 01:17:05
It would be good to explicitly mention how this di
Lasse Reichstein Nielsen
2015/08/25 06:23:00
Acknowledged.
Ivan Posva
2015/08/26 04:29:36
If we decide to remove packageRoot, then we do not
Lasse Reichstein Nielsen
2015/08/26 06:26:06
Acknowledged.
| |
| 193 */ | |
| 194 static Uri get packageRootUri => _Platform.packageRootUri; | |
|
Ivan Posva
2015/08/26 04:29:35
All the new getters here need to return Futures. T
Lasse Reichstein Nielsen
2015/08/26 06:26:06
Would it be possible to be blocking instead of asy
| |
| 195 | |
| 196 /** | |
| 197 * Returns the package mapping of the current isolate, if any. | |
|
floitsch
2015/08/24 15:09:45
Should we mention that the package-mapping (as wel
Lasse Reichstein Nielsen
2015/08/25 06:23:00
Acknowledged.
| |
| 198 * | |
| 199 * If the current isolate is using [packageRoot], this getter returns `null`. | |
|
nweiz
2015/08/25 01:17:05
Shouldn't this be [packageRootUri]? Presumably thi
Lasse Reichstein Nielsen
2015/08/25 06:23:00
Good catch.
I'm not sure if a default package root
| |
| 200 * | |
| 201 * The package map maps package names to a directory that package URIs for | |
| 202 * that package are resolved against, or to `null`, if the package name is | |
|
floitsch
2015/08/24 15:09:45
no need to specify the `null` case. That's the nor
Lasse Reichstein Nielsen
2015/08/25 06:23:00
True. Should just say that it only has keys for a
| |
| 203 * not recognized. | |
| 204 * | |
| 205 * Returns an empty map if the isolate does not have a way to resolve package | |
| 206 * URIs. | |
|
Ivan Posva
2015/08/25 04:50:39
Should return null if the isolate is not using a p
Lasse Reichstein Nielsen
2015/08/25 06:23:00
I chose to do this instead because it's more usefu
Ivan Posva
2015/08/26 04:29:35
Isn't that exactly what the null-aware operators w
Lasse Reichstein Nielsen
2015/08/26 06:26:06
That would be an argument if ?[] was actually in t
| |
| 207 */ | |
| 208 static Map<String, Uri> get packageMap => _Platform.packageMap; | |
| 209 | |
| 210 /** | |
| 188 * Returns the version of the current Dart runtime. | 211 * Returns the version of the current Dart runtime. |
| 189 * | 212 * |
| 190 * The returned `String` is formatted as the | 213 * The returned `String` is formatted as the |
| 191 * [semver](http://semver.org) version string of the current dart | 214 * [semver](http://semver.org) version string of the current dart |
| 192 * runtime, possibly followed by whitespace and other version and | 215 * runtime, possibly followed by whitespace and other version and |
| 193 * build details. | 216 * build details. |
| 194 */ | 217 */ |
| 195 static String get version => _version; | 218 static String get version => _version; |
| 196 } | 219 } |
| OLD | NEW |