Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 /** | 5 /** |
| 6 * Runtime information about the current platform. | 6 * Runtime information about the current platform. |
| 7 */ | 7 */ |
| 8 library dart.platform; | 8 library dart.platform; |
| 9 | |
| 10 /** | |
| 11 * The number of processors of the platform. | |
| 12 * | |
| 13 * Returns null if no information is available. | |
| 14 * | |
| 15 * Supported on the standalone Dart executable. | |
| 16 */ | |
| 17 external int get numberOfProcessors; | |
| 18 | |
| 19 /** | |
| 20 * The path separator used on the platform to separate | |
| 21 * components in file paths. | |
| 22 */ | |
| 23 external String get pathSeparator; | |
| 24 | |
| 25 /** | |
| 26 * A string (`linux`, `macos`, `windows` or `android`) | |
| 27 * representing the operating system. | |
| 28 * | |
| 29 * Returns null if the operating system could not be determined. | |
| 30 */ | |
| 31 external String get operatingSystem; | |
| 32 | |
| 33 /** | |
| 34 * The local hostname for the system. | |
| 35 * | |
| 36 * Returns null if the local hostname is not available. | |
| 37 * | |
| 38 * Supported on the standalone Dart executable. | |
| 39 */ | |
| 40 external String get localHostname; | |
| 41 | |
| 42 /** | |
| 43 * The version of the current Dart runtime. | |
| 44 * | |
| 45 * Returns null if not running a Dart runtime. | |
| 46 * | |
| 47 * Supported on the standalone Dart executable. | |
| 48 */ | |
| 49 external String get version; | |
| 50 | |
| 51 /** | |
|
Ivan Posva
2013/10/25 17:03:48
These specific testers are problematic. Let's assu
Bill Hesse
2013/10/25 17:50:00
Removed in CL 43773004
| |
| 52 * True if the operating system is Linux. | |
| 53 */ | |
| 54 // TODO(6997): Replace with bool get isLinux => operatingSystem == 'linux' | |
| 55 // when issue with patched top-level functions is fixed. | |
| 56 external bool get isLinux; | |
| 57 | |
| 58 /** | |
| 59 * True if the operating system is Mac OS. | |
| 60 */ | |
| 61 external bool get isMacOS; | |
| 62 | |
| 63 /** | |
| 64 * True if the operating system is Windows. | |
| 65 */ | |
| 66 external bool get isWindows; | |
| 67 | |
| 68 /** | |
| 69 * True if the operating system is Android. | |
| 70 */ | |
| 71 external bool get isAndroid; | |
| 72 | |
| 73 /** | |
| 74 * The environment for this instance of the platform. | |
| 75 * | |
| 76 * If environment variables are not supported on this platform, or not | |
| 77 * available, null is returned. | |
| 78 * | |
| 79 * Environment variables on Windows are case-insensitive. The map | |
| 80 * returned on Windows is therefore case-insensitive and converts | |
| 81 * all keys and key arguments to its methods to upper case. | |
| 82 * On other platforms the returned map is | |
| 83 * a standard case-sensitive map. | |
| 84 * | |
| 85 * Supported on the standalone Dart executable. | |
| 86 */ | |
| 87 external Map<String, String> get environment; | |
| 88 | |
| 89 /** | |
| 90 * The path of the executable this Dart isolate is running on. | |
| 91 * | |
| 92 * Returns null if the execution environment does not make the information | |
| 93 * available. | |
| 94 * | |
| 95 * Supported on the standalone Dart executable. | |
| 96 */ | |
| 97 external String get executable; | |
| 98 | |
| 99 /** | |
| 100 * The URI of the script being run in this isolate. | |
| 101 * | |
| 102 * If the URI is relative it is relative to the file URI of | |
| 103 * the working directory of the VM when it was started. | |
| 104 * | |
| 105 * Returns null if the executable environment does not make the information | |
| 106 * available. | |
| 107 * | |
| 108 * Supported on the standalone Dart executable. | |
| 109 */ | |
| 110 external Uri get script; | |
| 111 | |
| 112 /** | |
| 113 * The flags passed to the executable used to run the script in this | |
| 114 * isolate. These are the command-line flags between the executable name | |
| 115 * and the script name. | |
| 116 * | |
| 117 * Returns the empty list if [executableArguments] is not supported. | |
| 118 * | |
| 119 * Supported on the standalone Dart executable. | |
| 120 */ | |
| 121 external List<String> get executableArguments; | |
| 122 | |
| 123 /** | |
| 124 * The value of the --package-root flag passed to the executable | |
| 125 * used to run the script in this isolate. This is the directory in which | |
| 126 * Dart packages are looked up. | |
| 127 * | |
| 128 * If there is no --package-root flag, then the empty string is returned. | |
| 129 * | |
| 130 * Returns null if the information is not available on this platform. | |
| 131 * | |
| 132 * Supported on the standalone Dart executable. | |
| 133 */ | |
| 134 external String get packageRoot; | |
| OLD | NEW |