| 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; |
| 6 |
| 7 patch String get pathSeparator => _platform.pathSeparator; |
| 8 |
| 9 patch String get operatingSystem => _platform.operatingSystem; |
| 10 |
| 11 patch String get localHostname => _platform.localHostname; |
| 12 |
| 13 patch String get version => _platform.version; |
| 14 |
| 15 patch Map<String, String> get environment => _platform.environment; |
| 16 |
| 17 patch String get executable => _platform.executable; |
| 18 |
| 19 patch Uri get script => _platform.script; |
| 20 |
| 21 patch List<String> get executableArguments => _platform.executableArguments; |
| 22 |
| 23 patch String get packageRoot => _platform.packageRoot; |
| 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 { |
| 34 int get numberOfProcessors; |
| 35 String get pathSeparator; |
| 36 String get operatingSystem; |
| 37 String get localHostname; |
| 38 String get version; |
| 39 Map get environment; |
| 40 Uri get script; |
| 41 String get executable; |
| 42 List<String> get executableArguments; |
| 43 String get packageRoot; |
| 44 } |
| 45 |
| 46 // A non-default _Platform, with real values, is stored here by the embedder. |
| 47 _Platform _platform = new _DefaultPlatform(); |
| 48 |
| 49 class _DefaultPlatform implements _Platform { |
| 50 int get numberOfProcessors { |
| 51 return null; |
| 52 } |
| 53 |
| 54 String get pathSeparator { |
| 55 return "/"; |
| 56 } |
| 57 |
| 58 String get operatingSystem { |
| 59 return null; |
| 60 } |
| 61 |
| 62 String get localHostname { |
| 63 return null; |
| 64 } |
| 65 |
| 66 String get version { |
| 67 return null; |
| 68 } |
| 69 |
| 70 Map get environment { |
| 71 return null; |
| 72 } |
| 73 |
| 74 Uri get script { |
| 75 return null; |
| 76 } |
| 77 |
| 78 String get executable { |
| 79 return null; |
| 80 } |
| 81 |
| 82 List<String> get executableArguments { |
| 83 return new List<String>(0); |
| 84 } |
| 85 |
| 86 String get packageRoot { |
| 87 return null; |
| 88 } |
| 89 } |
| OLD | NEW |