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

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

Issue 46163009: Return an absolute URI for Platform.script. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix apidoc, add test. Created 7 years, 1 month 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/print_env.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 _executable();
13 external static _environment(); 13 external static _environment();
14 external static List<String> _executableArguments(); 14 external static List<String> _executableArguments();
15 external static String _packageRoot(); 15 external static String _packageRoot();
16 external static String _version(); 16 external static String _version();
17 17
18 static int get numberOfProcessors => _numberOfProcessors(); 18 static int get numberOfProcessors => _numberOfProcessors();
19 static String get pathSeparator => _pathSeparator(); 19 static String get pathSeparator => _pathSeparator();
20 static String get operatingSystem => _operatingSystem(); 20 static String get operatingSystem => _operatingSystem();
21 static Uri script = _script(); 21 static Uri script = _script();
22 static Uri _script() { 22 static Uri _script() {
23 // The embedder (Dart executable) creates the Platform._nativeScript field. 23 // The embedder (Dart executable) creates the Platform._nativeScript field.
24 var s = Platform._nativeScript; 24 var s = Platform._nativeScript;
25 if (s.startsWith('http:') || 25 if (s.startsWith('http:') ||
26 s.startsWith('https:') || 26 s.startsWith('https:') ||
27 s.startsWith('file:')) { 27 s.startsWith('file:')) {
28 return Uri.parse(s); 28 return Uri.parse(s);
29 } else { 29 } else {
30 return new Uri.file(s); 30 return Uri.base.resolveUri(new Uri.file(s));
31 } 31 }
32 } 32 }
33 33
34 static String get localHostname { 34 static String get localHostname {
35 var result = _localHostname(); 35 var result = _localHostname();
36 if (result is OSError) { 36 if (result is OSError) {
37 throw result; 37 throw result;
38 } else { 38 } else {
39 return result; 39 return result;
40 } 40 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 void clear() => _map.clear(); 101 void clear() => _map.clear();
102 void forEach(void f(String key, V value)) => _map.forEach(f); 102 void forEach(void f(String key, V value)) => _map.forEach(f);
103 Iterable<String> get keys => _map.keys; 103 Iterable<String> get keys => _map.keys;
104 Iterable<V> get values => _map.values; 104 Iterable<V> get values => _map.values;
105 int get length => _map.length; 105 int get length => _map.length;
106 bool get isEmpty => _map.isEmpty; 106 bool get isEmpty => _map.isEmpty;
107 bool get isNotEmpty => _map.isNotEmpty; 107 bool get isNotEmpty => _map.isNotEmpty;
108 108
109 Map<String, V> _map; 109 Map<String, V> _map;
110 } 110 }
OLDNEW
« no previous file with comments | « sdk/lib/io/platform.dart ('k') | tests/standalone/io/print_env.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698