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 28 matching lines...) Expand all Loading... |
39 | 39 |
40 // Cache the OS environemnt. This can be an OSError instance if | 40 // Cache the OS environemnt. This can be an OSError instance if |
41 // retrieving the environment failed. | 41 // retrieving the environment failed. |
42 static var _environmentCache; | 42 static var _environmentCache; |
43 | 43 |
44 static int get numberOfProcessors => _numberOfProcessors(); | 44 static int get numberOfProcessors => _numberOfProcessors(); |
45 static String get pathSeparator => _pathSeparator(); | 45 static String get pathSeparator => _pathSeparator(); |
46 static String get operatingSystem => _operatingSystem(); | 46 static String get operatingSystem => _operatingSystem(); |
47 static Uri script; | 47 static Uri script; |
48 | 48 |
49 // This script singleton is written to by the embedder if applicable. | |
50 static void set _nativeScript(String path) { | |
51 if (path.startsWith('http:') || | |
52 path.startsWith('https:') || | |
53 path.startsWith('package:') || | |
54 path.startsWith('dart:') || | |
55 path.startsWith('data:') || | |
56 path.startsWith('file:')) { | |
57 script = Uri.parse(path); | |
58 } else { | |
59 script = Uri.base.resolveUri(new Uri.file(path)); | |
60 } | |
61 } | |
62 | |
63 static String get localHostname { | 49 static String get localHostname { |
64 var result = _localHostname(); | 50 var result = _localHostname(); |
65 if (result is OSError) { | 51 if (result is OSError) { |
66 throw result; | 52 throw result; |
67 } else { | 53 } else { |
68 return result; | 54 return result; |
69 } | 55 } |
70 } | 56 } |
71 | 57 |
72 static List<String> get executableArguments => _executableArguments(); | 58 static List<String> get executableArguments => _executableArguments(); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 V remove(String key) => _map.remove(key.toUpperCase()); | 111 V remove(String key) => _map.remove(key.toUpperCase()); |
126 void clear() => _map.clear(); | 112 void clear() => _map.clear(); |
127 void forEach(void f(String key, V value)) => _map.forEach(f); | 113 void forEach(void f(String key, V value)) => _map.forEach(f); |
128 Iterable<String> get keys => _map.keys; | 114 Iterable<String> get keys => _map.keys; |
129 Iterable<V> get values => _map.values; | 115 Iterable<V> get values => _map.values; |
130 int get length => _map.length; | 116 int get length => _map.length; |
131 bool get isEmpty => _map.isEmpty; | 117 bool get isEmpty => _map.isEmpty; |
132 bool get isNotEmpty => _map.isNotEmpty; | 118 bool get isNotEmpty => _map.isNotEmpty; |
133 String toString() => _map.toString(); | 119 String toString() => _map.toString(); |
134 } | 120 } |
OLD | NEW |