| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 patch int get numberOfProcessors => _platform.numberOfProcessors; | 5 patch int get numberOfProcessors => _platform.numberOfProcessors; |
| 6 | 6 |
| 7 patch String get pathSeparator => _platform.pathSeparator; | 7 patch String get pathSeparator => _platform.pathSeparator; |
| 8 | 8 |
| 9 patch String get operatingSystem => _platform.operatingSystem; | 9 patch String get operatingSystem => _platform.operatingSystem; |
| 10 | 10 |
| 11 patch String get localHostname => _platform.localHostname; | 11 patch String get localHostname => _platform.localHostname; |
| 12 | 12 |
| 13 patch String get version => _platform.version; | 13 patch String get version => _platform.version; |
| 14 | 14 |
| 15 patch Map<String, String> get environment => _platform.environment; | 15 patch Map<String, String> get environment => _platform.environment; |
| 16 | 16 |
| 17 patch String get executable => _platform.executable; | 17 patch String get executable => _platform.executable; |
| 18 | 18 |
| 19 patch Uri get script => _platform.script; | 19 patch Uri get script => _platform.script; |
| 20 | 20 |
| 21 patch List<String> get executableArguments => _platform.executableArguments; | 21 patch List<String> get executableArguments => _platform.executableArguments; |
| 22 | 22 |
| 23 patch String get packageRoot => _platform.packageRoot; | 23 patch String get packageRoot => _platform.packageRoot; |
| 24 | 24 |
| 25 patch bool get isLinux => _platform.operatingSystem == "linux"; | |
| 26 | |
| 27 patch bool get isMacOS => _platform.operatingSystem == "macos"; | |
| 28 | |
| 29 patch bool get isWindows => _platform.operatingSystem == "windows"; | |
| 30 | |
| 31 patch bool get isAndroid => _platform.operatingSystem == "android"; | |
| 32 | |
| 33 class _Platform { | 25 class _Platform { |
| 34 int get numberOfProcessors; | 26 int get numberOfProcessors; |
| 35 String get pathSeparator; | 27 String get pathSeparator; |
| 36 String get operatingSystem; | 28 String get operatingSystem; |
| 37 String get localHostname; | 29 String get localHostname; |
| 38 String get version; | 30 String get version; |
| 39 Map get environment; | 31 Map get environment; |
| 40 Uri get script; | 32 Uri get script; |
| 41 String get executable; | 33 String get executable; |
| 42 List<String> get executableArguments; | 34 List<String> get executableArguments; |
| 43 String get packageRoot; | 35 String get packageRoot; |
| 44 } | 36 } |
| 45 | 37 |
| 46 // A non-default _Platform, with real values, is stored here by the embedder. | 38 // A non-default _Platform, with real values, is stored here by the embedder. |
| 47 _Platform _platform = new _DefaultPlatform(); | 39 _Platform _platform = new _DefaultPlatform(); |
| 48 | 40 |
| 49 class _DefaultPlatform implements _Platform { | 41 class _DefaultPlatform implements _Platform { |
| 50 int get numberOfProcessors { | 42 int get numberOfProcessors { |
| 51 return null; | 43 return null; |
| 52 } | 44 } |
| 53 | 45 |
| 54 String get pathSeparator { | 46 String get pathSeparator { |
| 55 return "/"; | 47 return null; |
| 56 } | 48 } |
| 57 | 49 |
| 58 String get operatingSystem { | 50 String get operatingSystem { |
| 59 return null; | 51 return null; |
| 60 } | 52 } |
| 61 | 53 |
| 62 String get localHostname { | 54 String get localHostname { |
| 63 return null; | 55 return null; |
| 64 } | 56 } |
| 65 | 57 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 80 } | 72 } |
| 81 | 73 |
| 82 List<String> get executableArguments { | 74 List<String> get executableArguments { |
| 83 return new List<String>(0); | 75 return new List<String>(0); |
| 84 } | 76 } |
| 85 | 77 |
| 86 String get packageRoot { | 78 String get packageRoot { |
| 87 return null; | 79 return null; |
| 88 } | 80 } |
| 89 } | 81 } |
| OLD | NEW |