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
31dc3c47
Commit
31dc3c47
authored
8 years ago
by
John McCutchan
Committed by
GitHub
8 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Try all possible Android SDK locations before giving up (#8730)
Fixes #8618
parent
3d5d63a8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
6 deletions
+32
-6
android_sdk.dart
packages/flutter_tools/lib/src/android/android_sdk.dart
+6
-4
os.dart
packages/flutter_tools/lib/src/base/os.dart
+22
-1
context.dart
packages/flutter_tools/test/src/context.dart
+4
-1
No files found.
packages/flutter_tools/lib/src/android/android_sdk.dart
View file @
31dc3c47
...
...
@@ -87,8 +87,9 @@ class AndroidSdk {
return
new
AndroidSdk
(
fs
.
path
.
join
(
androidHomeDir
,
'sdk'
));
}
File
aaptBin
=
os
.
which
(
'aapt'
);
// in build-tools/$version/aapt
if
(
aaptBin
!=
null
)
{
// in build-tools/$version/aapt
final
List
<
File
>
aaptBins
=
os
.
whichAll
(
'aapt'
);
for
(
File
aaptBin
in
aaptBins
)
{
// Make sure we're using the aapt from the SDK.
aaptBin
=
fs
.
file
(
aaptBin
.
resolveSymbolicLinksSync
());
final
String
dir
=
aaptBin
.
parent
.
parent
.
parent
.
path
;
...
...
@@ -96,8 +97,9 @@ class AndroidSdk {
return
new
AndroidSdk
(
dir
);
}
File
adbBin
=
os
.
which
(
'adb'
);
// in platform-tools/adb
if
(
adbBin
!=
null
)
{
// in platform-tools/adb
final
List
<
File
>
adbBins
=
os
.
whichAll
(
'adb'
);
for
(
File
adbBin
in
adbBins
)
{
// Make sure we're using the adb from the SDK.
adbBin
=
fs
.
file
(
adbBin
.
resolveSymbolicLinksSync
());
final
String
dir
=
adbBin
.
parent
.
parent
.
path
;
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/base/os.dart
View file @
31dc3c47
...
...
@@ -5,7 +5,6 @@
import
'dart:async'
;
import
'package:archive/archive.dart'
;
import
'context.dart'
;
import
'file_system.dart'
;
import
'io.dart'
;
...
...
@@ -34,6 +33,28 @@ abstract class OperatingSystemUtils {
/// if `which` was not able to locate the binary.
File
which
(
String
execName
);
/// Return a list of all paths to `execName` found on the system. Uses the
/// PATH environment variable.
List
<
File
>
whichAll
(
String
execName
)
{
final
List
<
File
>
result
=
<
File
>[];
final
String
pathEnvironmentVariable
=
platform
.
environment
[
'PATH'
];
for
(
final
String
pathComponent
in
_splitPath
(
pathEnvironmentVariable
))
{
final
String
pathToExecName
=
fs
.
path
.
join
(
pathComponent
,
execName
);
if
(
processManager
.
canRun
(
pathToExecName
))
{
result
.
add
(
fs
.
file
(
pathToExecName
));
}
}
return
result
;
}
List
<
String
>
_splitPath
(
String
pathEnvironmentVariable
)
{
final
String
delimiter
=
platform
.
isWindows
?
';'
:
':'
;
if
(
pathEnvironmentVariable
==
null
)
{
return
<
String
>[];
}
return
pathEnvironmentVariable
.
split
(
delimiter
);
}
/// Return the File representing a new pipe.
File
makePipe
(
String
path
);
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/src/context.dart
View file @
31dc3c47
...
...
@@ -151,7 +151,10 @@ class MockSimControl extends Mock implements SimControl {
}
}
class
MockOperatingSystemUtils
extends
Mock
implements
OperatingSystemUtils
{}
class
MockOperatingSystemUtils
extends
Mock
implements
OperatingSystemUtils
{
@override
List
<
File
>
whichAll
(
String
execName
)
=>
<
File
>[];
}
class
MockIOSSimulatorUtils
extends
Mock
implements
IOSSimulatorUtils
{}
...
...
This diff is collapsed.
Click to expand it.
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