| OLD | NEW |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:convert'; | 6 import 'dart:convert'; |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'package:args/args.dart'; | 9 import 'package:args/args.dart'; |
| 10 import 'package:sdk_services/sdk_services.dart'; | 10 import 'package:sdk_services/sdk_services.dart'; |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 _tmpDir = Directory.systemTemp.createTemp('flash_sd_card'); | 193 _tmpDir = Directory.systemTemp.createTemp('flash_sd_card'); |
| 194 } | 194 } |
| 195 } | 195 } |
| 196 return _tmpDir; | 196 return _tmpDir; |
| 197 } | 197 } |
| 198 | 198 |
| 199 Future get version async { | 199 Future get version async { |
| 200 if (_arguments['version'] != null) { | 200 if (_arguments['version'] != null) { |
| 201 return _arguments['version']; | 201 return _arguments['version']; |
| 202 } | 202 } |
| 203 const String fletchVm = const String.fromEnvironment("fletch-vm"); | 203 const String dartinoVm = const String.fromEnvironment("dartino-vm"); |
| 204 if (fletchVm == null || fletchVm.isEmpty) { | 204 if (dartinoVm == null || dartinoVm.isEmpty) { |
| 205 await failure( | 205 await failure( |
| 206 'Failed to determine SDK version. Please use the --version flag.'); | 206 'Failed to determine SDK version. Please use the --version flag.'); |
| 207 } | 207 } |
| 208 if (!await new File(fletchVm).exists()) { | 208 if (!await new File(dartinoVm).exists()) { |
| 209 await failure( | 209 await failure( |
| 210 'Failed to determine SDK version. ' | 210 'Failed to determine SDK version. ' |
| 211 "Cannot find the Fletch VM at the expected location '$fletchVm'." | 211 "Cannot find the Dartino VM at the expected location '$dartinoVm'." |
| 212 'Your SDK might be broken'); | 212 'Your SDK might be broken'); |
| 213 } | 213 } |
| 214 var result = await runProcess(fletchVm, ['--version']); | 214 var result = await runProcess(dartinoVm, ['--version']); |
| 215 if (result.exitCode != 0) { | 215 if (result.exitCode != 0) { |
| 216 await failure('Failed to determine SDK version'); | 216 await failure('Failed to determine SDK version'); |
| 217 } | 217 } |
| 218 return result.stdout.trim(); | 218 return result.stdout.trim(); |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 | 221 |
| 222 class Failure implements Exception { | 222 class Failure implements Exception { |
| 223 final String message; | 223 final String message; |
| 224 Failure(this.message); | 224 Failure(this.message); |
| 225 } | 225 } |
| OLD | NEW |