| OLD | NEW |
| 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 #library("drt_updater"); | 5 #library("drt_updater"); |
| 6 | 6 |
| 7 #import("dart:io"); | 7 #import("dart:io"); |
| 8 | 8 |
| 9 class _DartiumUpdater { | 9 class _DartiumUpdater { |
| 10 String name; | 10 String name; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 onUpdated = [() {updated = true;} ]; | 26 onUpdated = [() {updated = true;} ]; |
| 27 _updatingProcess = Process.start('python', _getUpdateCommand); | 27 _updatingProcess = Process.start('python', _getUpdateCommand); |
| 28 _updatingProcess.onExit = _onUpdatedHandler; | 28 _updatingProcess.onExit = _onUpdatedHandler; |
| 29 _updatingProcess.onError = (error) { | 29 _updatingProcess.onError = (error) { |
| 30 print("Error starting $script process: $error"); | 30 print("Error starting $script process: $error"); |
| 31 _onUpdatedHandler(-1); // Continue anyway. | 31 _onUpdatedHandler(-1); // Continue anyway. |
| 32 }; | 32 }; |
| 33 } | 33 } |
| 34 } | 34 } |
| 35 | 35 |
| 36 List<String> get _getUpdateCommand() { | 36 List<String> get _getUpdateCommand { |
| 37 String scriptPath = new Options().script.replaceAll('\\', '/'); | 37 String scriptPath = new Options().script.replaceAll('\\', '/'); |
| 38 String toolsDir = scriptPath.substring(0, scriptPath.lastIndexOf('/')); | 38 String toolsDir = scriptPath.substring(0, scriptPath.lastIndexOf('/')); |
| 39 List<String> command = ['$toolsDir/$script']; | 39 List<String> command = ['$toolsDir/$script']; |
| 40 if (null !== option) { | 40 if (null !== option) { |
| 41 command.add(option); | 41 command.add(option); |
| 42 } | 42 } |
| 43 return command; | 43 return command; |
| 44 } | 44 } |
| 45 | 45 |
| 46 void _onUpdatedHandler(int exit_code) { | 46 void _onUpdatedHandler(int exit_code) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 65 // Download the default Dartium from Google Storage. | 65 // Download the default Dartium from Google Storage. |
| 66 if (_dartiumUpdater === null) { | 66 if (_dartiumUpdater === null) { |
| 67 _dartiumUpdater = new _DartiumUpdater('Dartium Chrome', 'get_archive.py', | 67 _dartiumUpdater = new _DartiumUpdater('Dartium Chrome', 'get_archive.py', |
| 68 'dartium'); | 68 'dartium'); |
| 69 } | 69 } |
| 70 return _dartiumUpdater; | 70 return _dartiumUpdater; |
| 71 } else { | 71 } else { |
| 72 return null; | 72 return null; |
| 73 } | 73 } |
| 74 } | 74 } |
| OLD | NEW |