More Windows fixes

Added an exists check to ensure we don't try to run if emulator is missing, but that requires the file extension for Windows.
This commit is contained in:
Danny Tuppeny
2018-04-18 17:04:09 +01:00
committed by Danny Tuppeny
parent 03b5fe3d94
commit da5a64ec7f

View File

@@ -245,7 +245,7 @@ class AndroidSdk {
String get adbPath => getPlatformToolsPath('adb');
String get emulatorPath => getToolsPath('emulator');
String get emulatorPath => getEmulatorPath();
/// Validate the Android SDK. This returns an empty list if there are no
/// issues; otherwise, it returns a list of issues found.
@@ -263,8 +263,17 @@ class AndroidSdk {
return fs.path.join(directory, 'platform-tools', binaryName);
}
String getToolsPath(String binaryName) {
return fs.path.join(directory, 'tools', binaryName);
String getEmulatorPath() {
final String binaryName = platform.isWindows ? 'emulator.exe' : 'emulator';
// Emulator now lives inside "emulator" but used to live inside "tools" so
// try both.
final List<String> searchFolders = <String>['emulator', 'tools'];
for (final String folder in searchFolders) {
final String path = fs.path.join(directory, folder, binaryName);
if (fs.file(path).existsSync())
return path;
}
return null;
}
void _init() {