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

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

Issue 17175007: dart:io | Add cache and getters to Platform (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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 | « no previous file | 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 /** 7 /**
8 * The [Platform] class exposes details of the machine and operating 8 * The [Platform] class exposes details of the machine and operating
9 * system. 9 * system.
10 */ 10 */
11 class Platform { 11 class Platform {
12 static final _numberOfProcessors = _Platform.numberOfProcessors;
13 static final _pathSeparator = _Platform.pathSeparator;
14 static final _operatingSystem = _Platform.operatingSystem;
15 static final _localHostname = _Platform.localHostname;
16
12 /** 17 /**
13 * Get the number of processors of the machine. 18 * Get the number of processors of the machine.
14 */ 19 */
15 static int get numberOfProcessors => _Platform.numberOfProcessors; 20 static int get numberOfProcessors => _numberOfProcessors;
16 21
17 /** 22 /**
18 * Get the path separator used by the operating system to separate 23 * Get the path separator used by the operating system to separate
19 * components in file paths. 24 * components in file paths.
20 */ 25 */
21 static String get pathSeparator => _Platform.pathSeparator; 26 static String get pathSeparator => _pathSeparator;
22 27
23 /** 28 /**
24 * Get a string ('macos', 'windows', 'linux') representing the 29 * Get a string (`linux`, `macos`, `windows` or `android`)
25 * operating system. 30 * representing the operating system.
26 */ 31 */
27 static String get operatingSystem => _Platform.operatingSystem; 32 static String get operatingSystem => _operatingSystem;
28 33
29 /** 34 /**
30 * Get the local hostname for the system. 35 * Get the local hostname for the system.
31 */ 36 */
32 static String get localHostname => _Platform.localHostname; 37 static String get localHostname => _localHostname;
38
39 /**
40 * Returns true if the operating system is Linux.
41 */
42 static bool get isLinux => _operatingSystem == "linux";
43
44 /**
45 * Returns true if the operating system is Mac OS.
46 */
47 static bool get isMacOS => _operatingSystem == "macos";
48
49 /**
50 * Returns true if the operating system is Windows.
51 */
52 static bool get isWindows => _operatingSystem == "windows";
53
54 /**
55 * Returns true if the operating system is Android.
56 */
57 static bool get isAndroid => _operatingSystem == "android";
33 58
34 /** 59 /**
35 * Get the environment for this process. 60 * Get the environment for this process.
36 * 61 *
37 * Environment variables on Windows are case-insensitive. The map 62 * Environment variables on Windows are case-insensitive. The map
38 * returned on Windows is therefore case-insensitive and will convert 63 * returned on Windows is therefore case-insensitive and will convert
39 * all keys to upper case. On other platforms the returned map is 64 * all keys to upper case. On other platforms the returned map is
40 * a standard case-sensitive map. 65 * a standard case-sensitive map.
41 */ 66 */
42 static Map<String, String> get environment => _Platform.environment; 67 static Map<String, String> get environment => _Platform.environment;
43 } 68 }
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/io/platform_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698