Chromium Code Reviews| 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(); |
| 11 external static _localHostname(); | 11 external static _localHostname(); |
| 12 external static _executable(); | |
| 12 external static _environment(); | 13 external static _environment(); |
| 13 external static String _version(); | 14 external static String _version(); |
| 14 | 15 |
| 15 static int get numberOfProcessors => _numberOfProcessors(); | 16 static int get numberOfProcessors => _numberOfProcessors(); |
| 16 static String get pathSeparator => _pathSeparator(); | 17 static String get pathSeparator => _pathSeparator(); |
| 17 static String get operatingSystem => _operatingSystem(); | 18 static String get operatingSystem => _operatingSystem(); |
| 18 | 19 |
| 19 static String get localHostname { | 20 static String get localHostname { |
| 20 var result = _localHostname(); | 21 var result = _localHostname(); |
| 21 if (result is OSError) { | 22 if (result is OSError) { |
| 22 throw result; | 23 throw result; |
| 23 } else { | 24 } else { |
| 24 return result; | 25 return result; |
| 25 } | 26 } |
| 26 } | 27 } |
| 27 | 28 |
| 29 static String get executable { | |
|
Bill Hesse
2013/08/07 13:39:44
_executable() can never return null. It returns a
Søren Gjesse
2013/08/07 14:37:46
Initially I was expecting to handle NULL, but it c
| |
| 30 var executable = _executable(); | |
| 31 return executable != null ? executable : ""; | |
| 32 } | |
| 33 | |
| 28 static Map<String, String> get environment { | 34 static Map<String, String> get environment { |
| 29 var env = _environment(); | 35 var env = _environment(); |
| 30 if (env is OSError) { | 36 if (env is OSError) { |
| 31 throw env; | 37 throw env; |
| 32 } else { | 38 } else { |
| 33 var isWindows = operatingSystem == 'windows'; | 39 var isWindows = operatingSystem == 'windows'; |
| 34 var result = isWindows ? new _CaseInsensitiveStringMap() : new Map(); | 40 var result = isWindows ? new _CaseInsensitiveStringMap() : new Map(); |
| 35 for (var str in env) { | 41 for (var str in env) { |
| 36 // When running on Windows through cmd.exe there are strange | 42 // When running on Windows through cmd.exe there are strange |
| 37 // environment variables that are used to record the current | 43 // environment variables that are used to record the current |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 82 void clear() => _map.clear(); | 88 void clear() => _map.clear(); |
| 83 void forEach(void f(String key, V value)) => _map.forEach(f); | 89 void forEach(void f(String key, V value)) => _map.forEach(f); |
| 84 Iterable<String> get keys => _map.keys; | 90 Iterable<String> get keys => _map.keys; |
| 85 Iterable<V> get values => _map.values; | 91 Iterable<V> get values => _map.values; |
| 86 int get length => _map.length; | 92 int get length => _map.length; |
| 87 bool get isEmpty => _map.isEmpty; | 93 bool get isEmpty => _map.isEmpty; |
| 88 bool get isNotEmpty => _map.isNotEmpty; | 94 bool get isNotEmpty => _map.isNotEmpty; |
| 89 | 95 |
| 90 Map<String, V> _map; | 96 Map<String, V> _map; |
| 91 } | 97 } |
| OLD | NEW |