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 class _Platform { | 7 class _Platform { |
8 external static int _numberOfProcessors(); | 8 external static int _numberOfProcessors(); |
9 external static String _pathSeparator(); | 9 external static String _pathSeparator(); |
10 external static String _operatingSystem(); | 10 external static String _operatingSystem(); |
(...skipping 15 matching lines...) Expand all Loading... |
26 * A value may contain further '=' characters, and it may be empty. | 26 * A value may contain further '=' characters, and it may be empty. |
27 * | 27 * |
28 * Returns an [OSError] if retrieving the environment fails. | 28 * Returns an [OSError] if retrieving the environment fails. |
29 */ | 29 */ |
30 external static _environment(); | 30 external static _environment(); |
31 external static List<String> _executableArguments(); | 31 external static List<String> _executableArguments(); |
32 external static String _packageRoot(); | 32 external static String _packageRoot(); |
33 external static String _packageConfig(); | 33 external static String _packageConfig(); |
34 external static String _version(); | 34 external static String _version(); |
35 external static String _localeName(); | 35 external static String _localeName(); |
| 36 external static Uri _script(); |
36 | 37 |
37 static String executable = _executable(); | 38 static String executable = _executable(); |
38 static String resolvedExecutable = _resolvedExecutable(); | 39 static String resolvedExecutable = _resolvedExecutable(); |
39 static String packageRoot = _packageRoot(); | 40 static String packageRoot = _packageRoot(); |
40 static String packageConfig = _packageConfig(); | 41 static String packageConfig = _packageConfig(); |
41 | 42 |
42 static String _cachedLocaleName; | 43 static String _cachedLocaleName; |
43 static String get localeName { | 44 static String get localeName { |
44 if (_cachedLocaleName == null) { | 45 if (_cachedLocaleName == null) { |
45 var result = _localeName(); | 46 var result = _localeName(); |
46 if (result is OSError) { | 47 if (result is OSError) { |
47 throw result; | 48 throw result; |
48 } | 49 } |
49 _cachedLocaleName = result; | 50 _cachedLocaleName = result; |
50 } | 51 } |
51 return _cachedLocaleName; | 52 return _cachedLocaleName; |
52 } | 53 } |
53 | 54 |
54 // Cache the OS environment. This can be an OSError instance if | 55 // Cache the OS environment. This can be an OSError instance if |
55 // retrieving the environment failed. | 56 // retrieving the environment failed. |
56 static var /*OSError|Map<String,String>*/ _environmentCache; | 57 static var /*OSError|Map<String,String>*/ _environmentCache; |
57 | 58 |
58 static int get numberOfProcessors => _numberOfProcessors(); | 59 static int get numberOfProcessors => _numberOfProcessors(); |
59 static String get pathSeparator => _pathSeparator(); | 60 static String get pathSeparator => _pathSeparator(); |
60 static String get operatingSystem => _operatingSystem(); | 61 static String get operatingSystem => _operatingSystem(); |
61 static Uri script; | 62 static Uri get script => _script(); |
62 | 63 |
63 static String get localHostname { | 64 static String get localHostname { |
64 var result = _localHostname(); | 65 var result = _localHostname(); |
65 if (result is OSError) { | 66 if (result is OSError) { |
66 throw result; | 67 throw result; |
67 } else { | 68 } else { |
68 return result; | 69 return result; |
69 } | 70 } |
70 } | 71 } |
71 | 72 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 _map.forEach(f); | 141 _map.forEach(f); |
141 } | 142 } |
142 | 143 |
143 Iterable<String> get keys => _map.keys; | 144 Iterable<String> get keys => _map.keys; |
144 Iterable<V> get values => _map.values; | 145 Iterable<V> get values => _map.values; |
145 int get length => _map.length; | 146 int get length => _map.length; |
146 bool get isEmpty => _map.isEmpty; | 147 bool get isEmpty => _map.isEmpty; |
147 bool get isNotEmpty => _map.isNotEmpty; | 148 bool get isNotEmpty => _map.isNotEmpty; |
148 String toString() => _map.toString(); | 149 String toString() => _map.toString(); |
149 } | 150 } |
OLD | NEW |