Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Side by Side Diff: sdk/lib/io/platform_impl.dart

Issue 22565003: Make the values of Platform.executable and Platform.script available to all isolates (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments from whesse@ Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/io/platform.dart ('k') | tests/standalone/io/platform_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 executable = _executable();
30
28 static Map<String, String> get environment { 31 static Map<String, String> get environment {
29 var env = _environment(); 32 var env = _environment();
30 if (env is OSError) { 33 if (env is OSError) {
31 throw env; 34 throw env;
32 } else { 35 } else {
33 var isWindows = operatingSystem == 'windows'; 36 var isWindows = operatingSystem == 'windows';
34 var result = isWindows ? new _CaseInsensitiveStringMap() : new Map(); 37 var result = isWindows ? new _CaseInsensitiveStringMap() : new Map();
35 for (var str in env) { 38 for (var str in env) {
36 // When running on Windows through cmd.exe there are strange 39 // When running on Windows through cmd.exe there are strange
37 // environment variables that are used to record the current 40 // environment variables that are used to record the current
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 void clear() => _map.clear(); 85 void clear() => _map.clear();
83 void forEach(void f(String key, V value)) => _map.forEach(f); 86 void forEach(void f(String key, V value)) => _map.forEach(f);
84 Iterable<String> get keys => _map.keys; 87 Iterable<String> get keys => _map.keys;
85 Iterable<V> get values => _map.values; 88 Iterable<V> get values => _map.values;
86 int get length => _map.length; 89 int get length => _map.length;
87 bool get isEmpty => _map.isEmpty; 90 bool get isEmpty => _map.isEmpty;
88 bool get isNotEmpty => _map.isNotEmpty; 91 bool get isNotEmpty => _map.isNotEmpty;
89 92
90 Map<String, V> _map; 93 Map<String, V> _map;
91 } 94 }
OLDNEW
« no previous file with comments | « sdk/lib/io/platform.dart ('k') | tests/standalone/io/platform_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698