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 14 matching lines...) Expand all Loading... |
25 * Values are everything after the first '=' character. | 25 * Values are everything after the first '=' character. |
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 | 36 |
36 static String executable = _executable(); | 37 static String executable = _executable(); |
37 static String resolvedExecutable = _resolvedExecutable(); | 38 static String resolvedExecutable = _resolvedExecutable(); |
38 static String packageRoot = _packageRoot(); | 39 static String packageRoot = _packageRoot(); |
39 static String packageConfig = _packageConfig(); | 40 static String packageConfig = _packageConfig(); |
40 | 41 |
| 42 static String _cachedLocaleName; |
| 43 static String get localeName { |
| 44 if (_cachedLocaleName == null) { |
| 45 var result = _localeName(); |
| 46 if (result is OSError) { |
| 47 throw result; |
| 48 } |
| 49 _cachedLocaleName = result; |
| 50 } |
| 51 return _cachedLocaleName; |
| 52 } |
| 53 |
41 // Cache the OS environment. This can be an OSError instance if | 54 // Cache the OS environment. This can be an OSError instance if |
42 // retrieving the environment failed. | 55 // retrieving the environment failed. |
43 static var /*OSError|Map<String,String>*/ _environmentCache; | 56 static var /*OSError|Map<String,String>*/ _environmentCache; |
44 | 57 |
45 static int get numberOfProcessors => _numberOfProcessors(); | 58 static int get numberOfProcessors => _numberOfProcessors(); |
46 static String get pathSeparator => _pathSeparator(); | 59 static String get pathSeparator => _pathSeparator(); |
47 static String get operatingSystem => _operatingSystem(); | 60 static String get operatingSystem => _operatingSystem(); |
48 static Uri script; | 61 static Uri script; |
49 | 62 |
50 static String get localHostname { | 63 static String get localHostname { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 _map.forEach(f); | 140 _map.forEach(f); |
128 } | 141 } |
129 | 142 |
130 Iterable<String> get keys => _map.keys; | 143 Iterable<String> get keys => _map.keys; |
131 Iterable<V> get values => _map.values; | 144 Iterable<V> get values => _map.values; |
132 int get length => _map.length; | 145 int get length => _map.length; |
133 bool get isEmpty => _map.isEmpty; | 146 bool get isEmpty => _map.isEmpty; |
134 bool get isNotEmpty => _map.isNotEmpty; | 147 bool get isNotEmpty => _map.isNotEmpty; |
135 String toString() => _map.toString(); | 148 String toString() => _map.toString(); |
136 } | 149 } |
OLD | NEW |