Commit 6ff84d08 authored by Danny Tuppeny's avatar Danny Tuppeny Committed by Danny Tuppeny

Improve formatting

parent c0b2e783
...@@ -28,7 +28,7 @@ class AndroidEmulators extends EmulatorDiscovery { ...@@ -28,7 +28,7 @@ class AndroidEmulators extends EmulatorDiscovery {
class AndroidEmulator extends Emulator { class AndroidEmulator extends Emulator {
AndroidEmulator(String id, [this._properties]) AndroidEmulator(String id, [this._properties])
: super(id, _properties != null && _properties.isNotEmpty); : super(id, _properties != null && _properties.isNotEmpty);
Map<String, String> _properties; Map<String, String> _properties;
...@@ -44,10 +44,12 @@ class AndroidEmulator extends Emulator { ...@@ -44,10 +44,12 @@ class AndroidEmulator extends Emulator {
@override @override
Future<bool> launch() async { Future<bool> launch() async {
final Status status = logger.startProgress('Launching $id...'); final Status status = logger.startProgress('Launching $id...');
final RunResult launchResult = await runAsync(<String>[getEmulatorPath(), '-avd', id]); final RunResult launchResult =
await runAsync(<String>[getEmulatorPath(), '-avd', id]);
status.stop(); status.stop();
if (launchResult.exitCode != 0) { if (launchResult.exitCode != 0) {
printError('Error: emulator exited with exit code ${launchResult.exitCode}'); printError(
'Error: emulator exited with exit code ${launchResult.exitCode}');
printError('$launchResult'); printError('$launchResult');
return false; return false;
} }
...@@ -62,7 +64,7 @@ List<AndroidEmulator> getEmulatorAvds() { ...@@ -62,7 +64,7 @@ List<AndroidEmulator> getEmulatorAvds() {
if (emulatorPath == null) { if (emulatorPath == null) {
return <AndroidEmulator>[]; return <AndroidEmulator>[];
} }
final String listAvdsOutput = runSync(<String>[emulatorPath, '-list-avds']); final String listAvdsOutput = runSync(<String>[emulatorPath, '-list-avds']);
final List<AndroidEmulator> emulators = <AndroidEmulator>[]; final List<AndroidEmulator> emulators = <AndroidEmulator>[];
...@@ -86,7 +88,8 @@ AndroidEmulator _createEmulator(String id) { ...@@ -86,7 +88,8 @@ AndroidEmulator _createEmulator(String id) {
if (ini['path'] != null) { if (ini['path'] != null) {
final File configFile = fs.file(fs.path.join(ini['path'], 'config.ini')); final File configFile = fs.file(fs.path.join(ini['path'], 'config.ini'));
if (configFile.existsSync()) { if (configFile.existsSync()) {
final Map<String, String> properties = parseIniLines(configFile.readAsLinesSync()); final Map<String, String> properties =
parseIniLines(configFile.readAsLinesSync());
return new AndroidEmulator(id, properties); return new AndroidEmulator(id, properties);
} }
} }
...@@ -100,11 +103,12 @@ Map<String, String> parseIniLines(List<String> contents) { ...@@ -100,11 +103,12 @@ Map<String, String> parseIniLines(List<String> contents) {
final Iterable<List<String>> properties = contents final Iterable<List<String>> properties = contents
.map((String l) => l.trim()) .map((String l) => l.trim())
.where((String l) => // Strip blank lines/comments
l != '' && !l.startsWith('#')) // Strip blank lines/comments .where((String l) => l != '' && !l.startsWith('#'))
.where((String l) => // Discard anything that isn't simple name=value
l.contains('=')) // Discard anything that isn't simple name=value .where((String l) => l.contains('='))
.map((String l) => l.split('=')); // Split into name/value // Split into name/value
.map((String l) => l.split('='));
for (List<String> property in properties) { for (List<String> property in properties) {
results[property[0].trim()] = property[1].trim(); results[property[0].trim()] = property[1].trim();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment