Fix Android Studio 4.2 detection on Windows (#82484)

This commit is contained in:
Taha Tesser
2021-05-14 11:24:04 +05:30
committed by GitHub
parent 159bb94bea
commit 3c72ef374d
2 changed files with 60 additions and 0 deletions

View File

@@ -397,6 +397,30 @@ class AndroidStudio implements Comparable<AndroidStudio> {
}
}
// 4.2 has a different location for AndroidStudio installs on Windows.
if (globals.platform.isWindows && globals.platform.environment.containsKey('LOCALAPPDATA')) {
final File homeDot = globals.fs.file(globals.fs.path.join(
globals.platform.environment['LOCALAPPDATA']!,
'Google',
'AndroidStudio4.2',
'.home',
));
if (homeDot.existsSync()) {
final String installPath = homeDot.readAsStringSync();
if (globals.fs.isDirectorySync(installPath)) {
final AndroidStudio studio = AndroidStudio(
installPath,
version: Version(4, 2, 0),
studioAppName: 'Android Studio 4.2',
);
if (studio != null && !_hasStudioAt(studio.directory, newerThan: studio.version)) {
studios.removeWhere((AndroidStudio other) => other.directory == studio.directory);
studios.add(studio);
}
}
}
}
final String? configuredStudioDir = globals.config.getValue('android-studio-dir') as String?;
if (configuredStudioDir != null && !_hasStudioAt(configuredStudioDir)) {
studios.add(AndroidStudio(configuredStudioDir,