| 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; | 16 static final _version = _Platform.version; |
| 17 | 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. | 18 // This script singleton is written to by the embedder if applicable. |
| 22 static String _nativeScript = ''; | 19 static String _nativeScript = ''; |
| 23 | 20 |
| 24 /** | 21 /** |
| 25 * Get the number of processors of the machine. | 22 * Get the number of processors of the machine. |
| 26 */ | 23 */ |
| 27 static int get numberOfProcessors => _numberOfProcessors; | 24 static int get numberOfProcessors => _numberOfProcessors; |
| 28 | 25 |
| 29 /** | 26 /** |
| 30 * Get the path separator used by the operating system to separate | 27 * Get the path separator used by the operating system to separate |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 */ | 70 */ |
| 74 static Map<String, String> get environment => _Platform.environment; | 71 static Map<String, String> get environment => _Platform.environment; |
| 75 | 72 |
| 76 /** | 73 /** |
| 77 * Returns the path of the executable used to run the script in this | 74 * Returns the path of the executable used to run the script in this |
| 78 * isolate. | 75 * isolate. |
| 79 * | 76 * |
| 80 * If the execution environment does not support [executable] an empty | 77 * If the execution environment does not support [executable] an empty |
| 81 * string is returned. | 78 * string is returned. |
| 82 */ | 79 */ |
| 83 static String get executable => _nativeExecutable; | 80 static String get executable => _Platform.executable; |
| 84 | 81 |
| 85 /** | 82 /** |
| 86 * Returns the path of the script being run in this isolate. | 83 * Returns the URI (in String form) of the script being run in this |
| 84 * isolate. If the URI is relative it is relative to the file URI of |
| 85 * the working directory of the VM when it was started. |
| 87 * | 86 * |
| 88 * If the executable environment does not support [script] an empty | 87 * If the executable environment does not support [script] an empty |
| 89 * string is returned. | 88 * string is returned. |
| 90 */ | 89 */ |
| 91 static String get script => _nativeScript; | 90 static String get script => _nativeScript; |
| 92 | 91 |
| 93 | 92 |
| 94 /** | 93 /** |
| 95 * Returns the version of the current Dart runtime. | 94 * Returns the version of the current Dart runtime. |
| 96 */ | 95 */ |
| 97 static String get version => _version; | 96 static String get version => _version; |
| 98 } | 97 } |
| OLD | NEW |