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 _executable(); |
13 external static _resolvedExecutable(); | 13 external static _resolvedExecutable(); |
14 /** | 14 /** |
15 * Retrieve the entries of the process environment. | 15 * Retrieve the entries of the process environment. |
16 * | 16 * |
17 * The result is an [Iterable] of strings, where each string represents | 17 * The result is an [Iterable] of strings, where each string represents |
18 * an environment entry. | 18 * an environment entry. |
19 * | 19 * |
20 * Environment entries should be strings containing | 20 * Environment entries should be strings containing |
21 * a non-empty name and a value separated by a '=' character. | 21 * a non-empty name and a value separated by a '=' character. |
22 * The name does not contain a '=' character, | 22 * The name does not contain a '=' character, |
23 * so the name is everything up to the first '=' character. | 23 * so the name is everything up to the first '=' character. |
24 * Values are everything after the first '=' charcacter. | 24 * Values are everything after the first '=' character. |
25 * A value may contain further '=' characters, and it may be empty. | 25 * A value may contain further '=' characters, and it may be empty. |
26 * | 26 * |
27 * Returns an [OSError] if retrieving the environment fails. | 27 * Returns an [OSError] if retrieving the environment fails. |
28 */ | 28 */ |
29 external static _environment(); | 29 external static _environment(); |
30 external static List<String> _executableArguments(); | 30 external static List<String> _executableArguments(); |
31 external static String _packageRoot(); | 31 external static String _packageRoot(); |
| 32 external static _packageResolution(); |
32 external static String _version(); | 33 external static String _version(); |
33 | 34 |
34 static String executable = _executable(); | 35 static String executable = _executable(); |
35 static String resolvedExecutable = _resolvedExecutable(); | 36 static String resolvedExecutable = _resolvedExecutable(); |
36 static String packageRoot = _packageRoot(); | 37 static String packageRoot = _packageRoot(); |
| 38 static var _resolution = () { |
| 39 throw new UnimplementedError("TODO(iposva)"); |
| 40 } (); |
37 | 41 |
38 // Cache the OS environemnt. This can be an OSError instance if | 42 static Uri get packageRootUri { |
| 43 if (_resolution is Uri) return _resolution; |
| 44 return null; |
| 45 } |
| 46 |
| 47 static Map<String, Uri> get packageMap { |
| 48 if (_resolution is Map) return _resolution; |
| 49 if (_resolution == null) return const <String, Uri>{}; |
| 50 return null; |
| 51 } |
| 52 |
| 53 // Cache the OS environment. This can be an OSError instance if |
39 // retrieving the environment failed. | 54 // retrieving the environment failed. |
40 static var _environmentCache; | 55 static var _environmentCache; |
41 | 56 |
42 static int get numberOfProcessors => _numberOfProcessors(); | 57 static int get numberOfProcessors => _numberOfProcessors(); |
43 static String get pathSeparator => _pathSeparator(); | 58 static String get pathSeparator => _pathSeparator(); |
44 static String get operatingSystem => _operatingSystem(); | 59 static String get operatingSystem => _operatingSystem(); |
45 static Uri script; | 60 static Uri script; |
46 | 61 |
47 // This script singleton is written to by the embedder if applicable. | 62 // This script singleton is written to by the embedder if applicable. |
48 static void set _nativeScript(String path) { | 63 static void set _nativeScript(String path) { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 V remove(String key) => _map.remove(key.toUpperCase()); | 138 V remove(String key) => _map.remove(key.toUpperCase()); |
124 void clear() => _map.clear(); | 139 void clear() => _map.clear(); |
125 void forEach(void f(String key, V value)) => _map.forEach(f); | 140 void forEach(void f(String key, V value)) => _map.forEach(f); |
126 Iterable<String> get keys => _map.keys; | 141 Iterable<String> get keys => _map.keys; |
127 Iterable<V> get values => _map.values; | 142 Iterable<V> get values => _map.values; |
128 int get length => _map.length; | 143 int get length => _map.length; |
129 bool get isEmpty => _map.isEmpty; | 144 bool get isEmpty => _map.isEmpty; |
130 bool get isNotEmpty => _map.isNotEmpty; | 145 bool get isNotEmpty => _map.isNotEmpty; |
131 String toString() => _map.toString(); | 146 String toString() => _map.toString(); |
132 } | 147 } |
OLD | NEW |