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; |
74 | 75 |
75 /** | 76 /** |
76 * Get the number of processors of the machine. | 77 * Get the number of processors of the machine. |
77 */ | 78 */ |
78 static int get numberOfProcessors => _numberOfProcessors; | 79 static int get numberOfProcessors => _numberOfProcessors; |
79 | 80 |
80 /** | 81 /** |
81 * Get the path separator used by the operating system to separate | 82 * Get the path separator used by the operating system to separate |
82 * components in file paths. | 83 * components in file paths. |
83 */ | 84 */ |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 /** | 118 /** |
118 * Returns true if the operating system is iOS. | 119 * Returns true if the operating system is iOS. |
119 */ | 120 */ |
120 static final bool isIOS = (_operatingSystem == "ios"); | 121 static final bool isIOS = (_operatingSystem == "ios"); |
121 | 122 |
122 /** | 123 /** |
123 * Returns true if the operating system is Fuchsia | 124 * Returns true if the operating system is Fuchsia |
124 */ | 125 */ |
125 static final bool isFuchsia = (_operatingSystem == "fuchsia"); | 126 static final bool isFuchsia = (_operatingSystem == "fuchsia"); |
126 | 127 |
| 128 /** |
| 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 |
127 /** | 136 /** |
128 * Get the environment for this process. | 137 * Get the environment for this process. |
129 * | 138 * |
130 * The returned environment is an unmodifiable map which content is | 139 * The returned environment is an unmodifiable map which content is |
131 * retrieved from the operating system on its first use. | 140 * retrieved from the operating system on its first use. |
132 * | 141 * |
133 * Environment variables on Windows are case-insensitive. The map | 142 * Environment variables on Windows are case-insensitive. The map |
134 * returned on Windows is therefore case-insensitive and will convert | 143 * returned on Windows is therefore case-insensitive and will convert |
135 * all keys to upper case. On other platforms the returned map is | 144 * all keys to upper case. On other platforms the returned map is |
136 * a standard case-sensitive map. | 145 * a standard case-sensitive map. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 /** | 215 /** |
207 * Returns the version of the current Dart runtime. | 216 * Returns the version of the current Dart runtime. |
208 * | 217 * |
209 * The returned `String` is formatted as the | 218 * The returned `String` is formatted as the |
210 * [semver](http://semver.org) version string of the current dart | 219 * [semver](http://semver.org) version string of the current dart |
211 * runtime, possibly followed by whitespace and other version and | 220 * runtime, possibly followed by whitespace and other version and |
212 * build details. | 221 * build details. |
213 */ | 222 */ |
214 static String get version => _version; | 223 static String get version => _version; |
215 } | 224 } |
OLD | NEW |