| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 * [Dart by Example](https://www.dartlang.org/dart-by-example/#dart-io-and-comma
nd-line-apps) | 64 * [Dart by Example](https://www.dartlang.org/dart-by-example/#dart-io-and-comma
nd-line-apps) |
| 65 * provides additional task-oriented code samples that show how to use | 65 * provides additional task-oriented code samples that show how to use |
| 66 * various API from the [dart:io] library. | 66 * various API from the [dart:io] library. |
| 67 */ | 67 */ |
| 68 class Platform { | 68 class Platform { |
| 69 static final _numberOfProcessors = _Platform.numberOfProcessors; | 69 static final _numberOfProcessors = _Platform.numberOfProcessors; |
| 70 static final _pathSeparator = _Platform.pathSeparator; | 70 static final _pathSeparator = _Platform.pathSeparator; |
| 71 static final _operatingSystem = _Platform.operatingSystem; | 71 static final _operatingSystem = _Platform.operatingSystem; |
| 72 static final _localHostname = _Platform.localHostname; | 72 static final _localHostname = _Platform.localHostname; |
| 73 static final _version = _Platform.version; | 73 static final _version = _Platform.version; |
| 74 static final _ansiSupported = _Platform.ansiSupported; | |
| 75 | 74 |
| 76 /** | 75 /** |
| 77 * Get the number of processors of the machine. | 76 * Get the number of processors of the machine. |
| 78 */ | 77 */ |
| 79 static int get numberOfProcessors => _numberOfProcessors; | 78 static int get numberOfProcessors => _numberOfProcessors; |
| 80 | 79 |
| 81 /** | 80 /** |
| 82 * Get the path separator used by the operating system to separate | 81 * Get the path separator used by the operating system to separate |
| 83 * components in file paths. | 82 * components in file paths. |
| 84 */ | 83 */ |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 * Returns true if the operating system is iOS. | 118 * Returns true if the operating system is iOS. |
| 120 */ | 119 */ |
| 121 static final bool isIOS = (_operatingSystem == "ios"); | 120 static final bool isIOS = (_operatingSystem == "ios"); |
| 122 | 121 |
| 123 /** | 122 /** |
| 124 * Returns true if the operating system is Fuchsia | 123 * Returns true if the operating system is Fuchsia |
| 125 */ | 124 */ |
| 126 static final bool isFuchsia = (_operatingSystem == "fuchsia"); | 125 static final bool isFuchsia = (_operatingSystem == "fuchsia"); |
| 127 | 126 |
| 128 /** | 127 /** |
| 129 * When stdio is connected to a terminal, whether ANSI codes are supported. | |
| 130 * | |
| 131 * This value is hard-coded to `true`, except on Windows where only more | |
| 132 * recent versions of Windows 10 support the codes. | |
| 133 */ | |
| 134 static final bool ansiSupported = _ansiSupported; | |
| 135 | |
| 136 /** | |
| 137 * Get the environment for this process. | 128 * Get the environment for this process. |
| 138 * | 129 * |
| 139 * The returned environment is an unmodifiable map which content is | 130 * The returned environment is an unmodifiable map which content is |
| 140 * retrieved from the operating system on its first use. | 131 * retrieved from the operating system on its first use. |
| 141 * | 132 * |
| 142 * Environment variables on Windows are case-insensitive. The map | 133 * Environment variables on Windows are case-insensitive. The map |
| 143 * returned on Windows is therefore case-insensitive and will convert | 134 * returned on Windows is therefore case-insensitive and will convert |
| 144 * all keys to upper case. On other platforms the returned map is | 135 * all keys to upper case. On other platforms the returned map is |
| 145 * a standard case-sensitive map. | 136 * a standard case-sensitive map. |
| 146 */ | 137 */ |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 /** | 206 /** |
| 216 * Returns the version of the current Dart runtime. | 207 * Returns the version of the current Dart runtime. |
| 217 * | 208 * |
| 218 * The returned `String` is formatted as the | 209 * The returned `String` is formatted as the |
| 219 * [semver](http://semver.org) version string of the current dart | 210 * [semver](http://semver.org) version string of the current dart |
| 220 * runtime, possibly followed by whitespace and other version and | 211 * runtime, possibly followed by whitespace and other version and |
| 221 * build details. | 212 * build details. |
| 222 */ | 213 */ |
| 223 static String get version => _version; | 214 static String get version => _version; |
| 224 } | 215 } |
| OLD | NEW |