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

Side by Side Diff: sdk/lib/io/platform.dart

Issue 2751913006: Clean up documentation of Platform in dart:io. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 static final _ansiSupported = _Platform.ansiSupported;
75 75
76 /** 76 /**
77 * Get the number of processors of the machine. 77 * The number of processors of the machine.
78 */ 78 */
79 static int get numberOfProcessors => _numberOfProcessors; 79 static int get numberOfProcessors => _numberOfProcessors;
80 80
81 /** 81 /**
82 * Get the path separator used by the operating system to separate 82 * Te path separator used by the operating system to separate
jensj 2017/03/20 07:42:30 "The"?
Lasse Reichstein Nielsen 2017/04/04 07:25:15 Done.
83 * components in file paths. 83 * components in file paths.
84 */ 84 */
85 static String get pathSeparator => _pathSeparator; 85 static String get pathSeparator => _pathSeparator;
86 86
87 /** 87 /**
88 * Get a string (`linux`, `macos`, `windows`, `android`, or `ios`) 88 * A string representing the operating system or platform.
89 * representing the operating system.
90 */ 89 */
91 static String get operatingSystem => _operatingSystem; 90 static String get operatingSystem => _operatingSystem;
92 91
93 /** 92 /**
94 * Get the local hostname for the system. 93 * The local hostname for the system.
95 */ 94 */
96 static String get localHostname => _localHostname; 95 static String get localHostname => _localHostname;
97 96
98 /** 97 /**
99 * Returns true if the operating system is Linux. 98 * Whether the operating system is a version of [Linux](https://en.wikipedia.o rg/wiki/Linux).
99 *
100 * This value is `false` if the operating system is a specialized
101 * version of Linux that identifies itself by a different name, e.g., Android.
floitsch 2017/03/17 15:52:37 don't use "e.g."
Lasse Reichstein Nielsen 2017/04/04 07:25:15 Done.
100 */ 102 */
101 static final bool isLinux = (_operatingSystem == "linux"); 103 static final bool isLinux = (_operatingSystem == "linux");
102 104
103 /** 105 /**
104 * Returns true if the operating system is OS X. 106 * Whether the operating system is a version of [macOS](https://en.wikipedia.o rg/wiki/MacOS).
floitsch 2017/03/17 15:52:37 long line.
Lasse Reichstein Nielsen 2017/04/04 07:25:15 Turns out that it works if you break the line befo
105 */ 107 */
106 static final bool isMacOS = (_operatingSystem == "macos"); 108 static final bool isMacOS = (_operatingSystem == "macos");
107 109
108 /** 110 /**
109 * Returns true if the operating system is Windows. 111 * Whether the operating system is a version of [Microsoft Windows](https://en .wikipedia.org/wiki/Microsoft_Windows).
floitsch 2017/03/17 15:52:37 long line.
110 */ 112 */
111 static final bool isWindows = (_operatingSystem == "windows"); 113 static final bool isWindows = (_operatingSystem == "windows");
112 114
113 /** 115 /**
114 * Returns true if the operating system is Android. 116 * Whether the operating system is a version of [Android](https://en.wikipedia .org/wiki/Android_(operating_system)).
floitsch 2017/03/17 15:52:37 long line.
115 */ 117 */
116 static final bool isAndroid = (_operatingSystem == "android"); 118 static final bool isAndroid = (_operatingSystem == "android");
117 119
118 /** 120 /**
119 * Returns true if the operating system is iOS. 121 * Whether the operating system is a version of [iOS](https://en.wikipedia.org /wiki/IOS).
floitsch 2017/03/17 15:52:37 long line.
120 */ 122 */
121 static final bool isIOS = (_operatingSystem == "ios"); 123 static final bool isIOS = (_operatingSystem == "ios");
122 124
123 /** 125 /**
124 * Returns true if the operating system is Fuchsia 126 * Whether the operating system is a version of [Fuchsia](https://en.wikipedia .org/wiki/Google_Fuchsia).
floitsch 2017/03/17 15:52:37 lon line.
125 */ 127 */
126 static final bool isFuchsia = (_operatingSystem == "fuchsia"); 128 static final bool isFuchsia = (_operatingSystem == "fuchsia");
127 129
128 /** 130 /**
129 * When stdio is connected to a terminal, whether ANSI codes are supported. 131 * When stdio is connected to a terminal, whether ANSI codes are supported.
130 * 132 *
131 * This value is hard-coded to `true`, except on Windows where only more 133 * This value is hard-coded to `true`, except on Windows where only more
132 * recent versions of Windows 10 support the codes. 134 * recent versions of Windows 10 support the codes.
133 */ 135 */
134 static final bool ansiSupported = _ansiSupported; 136 static final bool ansiSupported = _ansiSupported;
135 137
136 /** 138 /**
137 * Get the environment for this process. 139 * The environment for this process as a map from string key to string value.
138 * 140 *
139 * The returned environment is an unmodifiable map which content is 141 * The map is unmodifiable,
140 * retrieved from the operating system on its first use. 142 * and its content is retrieved from the operating system on its first use.
141 * 143 *
142 * Environment variables on Windows are case-insensitive. The map 144 * Environment variables on Windows are case-insensitive,
143 * returned on Windows is therefore case-insensitive and will convert 145 * so on Windows the map is case-insensitive and will convert
144 * all keys to upper case. On other platforms the returned map is 146 * all keys to upper case.
145 * a standard case-sensitive map. 147 * On other platforms, keys can be distinguished by case.
146 */ 148 */
147 static Map<String, String> get environment => _Platform.environment; 149 static Map<String, String> get environment => _Platform.environment;
148 150
149 /** 151 /**
150 * Returns the path of the executable used to run the script in this 152 * The path of the executable used to run the script in this isolate.
151 * isolate.
152 * 153 *
153 * The path returned is the literal path used to run the script. This 154 * The path is the literal path used to run the script. This
floitsch 2017/03/17 15:52:37 The literal path used to run the script.
Lasse Reichstein Nielsen 2017/04/04 07:25:15 Done.
154 * path might be relative or just be a name from which the executable 155 * path might be relative or just be a name from which the executable
155 * was found by searching the `PATH`. 156 * was found by searching the `PATH`.
156 * 157 *
157 * To get the absolute path to the resolved executable use 158 * To get the absolute path to the resolved executable use
158 * [resolvedExecutable]. 159 * [resolvedExecutable].
159 */ 160 */
160 static String get executable => _Platform.executable; 161 static String get executable => _Platform.executable;
161 162
162 /** 163 /**
163 * Returns the path of the executable used to run the script in this 164 * The path of the executable used to run the script in this
164 * isolate after it has been resolved by the OS. 165 * isolate after it has been resolved by the OS.
165 * 166 *
166 * This is the absolute path, with all symlinks resolved, to the 167 * This is the absolute path, with all symlinks resolved, to the
167 * executable used to run the script. 168 * executable used to run the script.
168 */ 169 */
169 static String get resolvedExecutable => _Platform.resolvedExecutable; 170 static String get resolvedExecutable => _Platform.resolvedExecutable;
170 171
171 /** 172 /**
172 * Returns the absolute URI of the script being run in this 173 * The absolute URI of the script being run in this isolate.
173 * isolate.
174 * 174 *
175 * If the script argument on the command line is relative, 175 * If the script argument on the command line is relative,
176 * it is resolved to an absolute URI before fetching the script, and 176 * it is resolved to an absolute URI before fetching the script, and
177 * this absolute URI is returned. 177 * that absolute URI is returned.
178 * 178 *
179 * URI resolution only does string manipulation on the script path, and this 179 * URI resolution only does string manipulation on the script path, and this
180 * may be different from the file system's path resolution behavior. For 180 * may be different from the file system's path resolution behavior. For
181 * example, a symbolic link immediately followed by '..' will not be 181 * example, a symbolic link immediately followed by '..' will not be
182 * looked up. 182 * looked up.
183 * 183 *
184 * If the executable environment does not support [script] an empty 184 * If the executable environment does not support [script],
185 * [Uri] is returned. 185 * the URI is empty.
186 */ 186 */
187 static Uri get script => _Platform.script; 187 static Uri get script => _Platform.script;
188 188
189 /** 189 /**
190 * Returns the flags passed to the executable used to run the script in this 190 * The flags passed to the executable used to run the script in this isolate.
191 * isolate. These are the command-line flags between the executable name 191 *
192 * and the script name. Each fetch of executableArguments returns a new 192 * These are the command-line flags to the executable that precedes
193 * List, containing the flags passed to the executable. 193 * the script name.
194 * Provides a new list every time the value is read.
194 */ 195 */
195 static List<String> get executableArguments => _Platform.executableArguments; 196 static List<String> get executableArguments => _Platform.executableArguments;
196 197
197 /** 198 /**
198 * Returns the value of the `--package-root` flag passed to the executable 199 * The `--package-root` flag passed to the executable used to run the script
199 * used to run the script in this isolate. This is the directory in which 200 * in this isolate.
200 * Dart packages are looked up.
201 * 201 *
202 * If there is no `--package-root` flag, `null` is returned. 202 * If present, it specifies the directory where Dart packages are looked up.
203 *
204 * Is `null` if there is no `--package-root` flag.
203 */ 205 */
204 static String get packageRoot => _Platform.packageRoot; 206 static String get packageRoot => _Platform.packageRoot;
205 207
206 /** 208 /**
207 * Returns the value of the `--packages` flag passed to the executable 209 * The `--packages` flag passed to the executable used to run the script
208 * used to run the script in this isolate. This is the configuration which 210 * in this isolate.
209 * specifies how Dart packages are looked up. 211 *
210 * 212 * If present, it specifies a file describing how Dart packages are looked up.
211 * If there is no `--packages` flag, `null` is returned. 213 *
212 */ 214 * Is `null` if there is no `--packages` flag.
215 */
213 static String get packageConfig => _Platform.packageConfig; 216 static String get packageConfig => _Platform.packageConfig;
214 217
215 /** 218 /**
216 * Returns the version of the current Dart runtime. 219 * The version of the current Dart runtime.
217 * 220 *
218 * The returned `String` is formatted as the 221 * The value is a [semantic versioning](http://semver.org)
219 * [semver](http://semver.org) version string of the current dart 222 * string representing the version of the current Dart runtime,
220 * runtime, possibly followed by whitespace and other version and 223 * possibly followed by whitespace and other version and
221 * build details. 224 * build details.
222 */ 225 */
223 static String get version => _version; 226 static String get version => _version;
224 } 227 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698