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 * The [Platform] class exposes details of the machine and operating | 8 * The [Platform] class exposes details of the machine and operating |
9 * system. | 9 * system. |
10 */ | 10 */ |
11 class Platform { | 11 class Platform { |
12 static final _numberOfProcessors = _Platform.numberOfProcessors; | 12 static final _numberOfProcessors = _Platform.numberOfProcessors; |
13 static final _pathSeparator = _Platform.pathSeparator; | 13 static final _pathSeparator = _Platform.pathSeparator; |
14 static final _operatingSystem = _Platform.operatingSystem; | 14 static final _operatingSystem = _Platform.operatingSystem; |
15 static final _localHostname = _Platform.localHostname; | 15 static final _localHostname = _Platform.localHostname; |
| 16 static final _version = _Platform.version; |
| 17 |
| 18 // This executable singleton is written to by the embedder if applicable. |
| 19 static String _nativeExecutable = ''; |
| 20 |
| 21 // This script singleton is written to by the embedder if applicable. |
| 22 static String _nativeScript = ''; |
16 | 23 |
17 /** | 24 /** |
18 * Get the number of processors of the machine. | 25 * Get the number of processors of the machine. |
19 */ | 26 */ |
20 static int get numberOfProcessors => _numberOfProcessors; | 27 static int get numberOfProcessors => _numberOfProcessors; |
21 | 28 |
22 /** | 29 /** |
23 * Get the path separator used by the operating system to separate | 30 * Get the path separator used by the operating system to separate |
24 * components in file paths. | 31 * components in file paths. |
25 */ | 32 */ |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 65 |
59 /** | 66 /** |
60 * Get the environment for this process. | 67 * Get the environment for this process. |
61 * | 68 * |
62 * Environment variables on Windows are case-insensitive. The map | 69 * Environment variables on Windows are case-insensitive. The map |
63 * returned on Windows is therefore case-insensitive and will convert | 70 * returned on Windows is therefore case-insensitive and will convert |
64 * all keys to upper case. On other platforms the returned map is | 71 * all keys to upper case. On other platforms the returned map is |
65 * a standard case-sensitive map. | 72 * a standard case-sensitive map. |
66 */ | 73 */ |
67 static Map<String, String> get environment => _Platform.environment; | 74 static Map<String, String> get environment => _Platform.environment; |
| 75 |
| 76 /** |
| 77 * Returns the path of the executable used to run the script in this |
| 78 * isolate. |
| 79 * |
| 80 * If the execution environment does not support [executable] an empty |
| 81 * string is returned. |
| 82 */ |
| 83 static String get executable => _nativeExecutable; |
| 84 |
| 85 /** |
| 86 * Returns the path of the script being run in this isolate. |
| 87 * |
| 88 * If the executable environment does not support [script] an empty |
| 89 * string is returned. |
| 90 */ |
| 91 static String get script => _nativeScript; |
| 92 |
| 93 |
| 94 /** |
| 95 * Returns the version of the current Dart runtime. |
| 96 */ |
| 97 static String get version => _version; |
68 } | 98 } |
OLD | NEW |