Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
3c72ef37
Unverified
Commit
3c72ef37
authored
May 14, 2021
by
Taha Tesser
Committed by
GitHub
May 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Android Studio 4.2 detection on Windows (#82484)
parent
159bb94b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
0 deletions
+60
-0
android_studio.dart
packages/flutter_tools/lib/src/android/android_studio.dart
+24
-0
android_studio_test.dart
...tools/test/general.shard/android/android_studio_test.dart
+36
-0
No files found.
packages/flutter_tools/lib/src/android/android_studio.dart
View file @
3c72ef37
...
...
@@ -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
,
...
...
packages/flutter_tools/test/general.shard/android/android_studio_test.dart
View file @
3c72ef37
...
...
@@ -409,6 +409,24 @@ void main() {
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'Can discover Android Studio 4.2 location on Windows'
,
()
{
windowsFileSystem
.
file
(
r'C:\Users\Dash\AppData\Local\Google\AndroidStudio4.2\.home'
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
r'C:\Program Files\AndroidStudio'
);
windowsFileSystem
.
directory
(
r'C:\Program Files\AndroidStudio'
)
.
createSync
(
recursive:
true
);
final
AndroidStudio
studio
=
AndroidStudio
.
allInstalled
().
single
;
expect
(
studio
.
version
,
Version
(
4
,
2
,
0
));
expect
(
studio
.
studioAppName
,
'Android Studio 4.2'
);
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
windowsPlatform
,
FileSystem:
()
=>
windowsFileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'Does not discover Android Studio 4.1 location on Windows if LOCALAPPDATA is null'
,
()
{
windowsFileSystem
.
file
(
r'C:\Users\Dash\AppData\Local\Google\AndroidStudio4.1\.home'
)
..
createSync
(
recursive:
true
)
...
...
@@ -427,6 +445,24 @@ void main() {
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'Does not discover Android Studio 4.2 location on Windows if LOCALAPPDATA is null'
,
()
{
windowsFileSystem
.
file
(
r'C:\Users\Dash\AppData\Local\Google\AndroidStudio4.2\.home'
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
r'C:\Program Files\AndroidStudio'
);
windowsFileSystem
.
directory
(
r'C:\Program Files\AndroidStudio'
)
.
createSync
(
recursive:
true
);
expect
(
AndroidStudio
.
allInstalled
(),
isEmpty
);
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
FakePlatform
(
operatingSystem:
'windows'
,
environment:
<
String
,
String
>{},
// Does not include LOCALAPPDATA
),
FileSystem:
()
=>
windowsFileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
group
(
'Installation detection on Linux'
,
()
{
FileSystemUtils
fsUtils
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment