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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 static Map<String, String> get environment { | 60 static Map<String, String> get environment { |
61 if (_environmentCache == null) { | 61 if (_environmentCache == null) { |
62 var env = _environment(); | 62 var env = _environment(); |
63 if (env is !OSError) { | 63 if (env is !OSError) { |
64 var isWindows = operatingSystem == 'windows'; | 64 var isWindows = operatingSystem == 'windows'; |
65 var result = isWindows | 65 var result = isWindows |
66 ? new _CaseInsensitiveStringMap<String>() | 66 ? new _CaseInsensitiveStringMap<String>() |
67 : new Map<String, String>(); | 67 : new Map<String, String>(); |
68 for (var str in env) { | 68 for (var str in env) { |
| 69 if (str == null) { |
| 70 continue; |
| 71 } |
69 // The Strings returned by [_environment()] are expected to be | 72 // The Strings returned by [_environment()] are expected to be |
70 // valid environment entries, but exceptions have been seen | 73 // valid environment entries, but exceptions have been seen |
71 // (e.g., an entry of just '=' has been seen on OS/X). | 74 // (e.g., an entry of just '=' has been seen on OS/X). |
72 // Invalid entries (lines without a '=' or with an empty name) | 75 // Invalid entries (lines without a '=' or with an empty name) |
73 // are discarded. | 76 // are discarded. |
74 var equalsIndex = str.indexOf('='); | 77 var equalsIndex = str.indexOf('='); |
75 if (equalsIndex > 0) { | 78 if (equalsIndex > 0) { |
76 result[str.substring(0, equalsIndex)] = | 79 result[str.substring(0, equalsIndex)] = |
77 str.substring(equalsIndex + 1); | 80 str.substring(equalsIndex + 1); |
78 } | 81 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 V remove(Object key) => key is String ? _map.remove(key.toUpperCase()) : null; | 117 V remove(Object key) => key is String ? _map.remove(key.toUpperCase()) : null; |
115 void clear() { _map.clear(); } | 118 void clear() { _map.clear(); } |
116 void forEach(void f(String key, V value)) { _map.forEach(f); } | 119 void forEach(void f(String key, V value)) { _map.forEach(f); } |
117 Iterable<String> get keys => _map.keys; | 120 Iterable<String> get keys => _map.keys; |
118 Iterable<V> get values => _map.values; | 121 Iterable<V> get values => _map.values; |
119 int get length => _map.length; | 122 int get length => _map.length; |
120 bool get isEmpty => _map.isEmpty; | 123 bool get isEmpty => _map.isEmpty; |
121 bool get isNotEmpty => _map.isNotEmpty; | 124 bool get isNotEmpty => _map.isNotEmpty; |
122 String toString() => _map.toString(); | 125 String toString() => _map.toString(); |
123 } | 126 } |
OLD | NEW |