Ensure we find dart.exe on local engines (#41514)
diff --git a/packages/flutter_tools/lib/src/artifacts.dart b/packages/flutter_tools/lib/src/artifacts.dart
index 8c9591d..1f9a8a3 100644
--- a/packages/flutter_tools/lib/src/artifacts.dart
+++ b/packages/flutter_tools/lib/src/artifacts.dart
@@ -158,6 +158,19 @@
String getEngineType(TargetPlatform platform, [ BuildMode mode ]);
}
+TargetPlatform get _currentHostPlatform {
+ if (platform.isMacOS) {
+ return TargetPlatform.darwin_x64;
+ }
+ if (platform.isLinux) {
+ return TargetPlatform.linux_x64;
+ }
+ if (platform.isWindows) {
+ return TargetPlatform.windows_x64;
+ }
+ throw UnimplementedError('Host OS not supported.');
+}
+
/// Manages the engine artifacts downloaded to the local cache.
class CachedArtifacts extends Artifacts {
@@ -337,19 +350,6 @@
assert(false, 'Invalid platform $platform.');
return null;
}
-
- TargetPlatform get _currentHostPlatform {
- if (platform.isMacOS) {
- return TargetPlatform.darwin_x64;
- }
- if (platform.isLinux) {
- return TargetPlatform.linux_x64;
- }
- if (platform.isWindows) {
- return TargetPlatform.windows_x64;
- }
- throw UnimplementedError('Host OS not supported.');
- }
}
/// Manages the artifacts of a locally built engine.
@@ -362,7 +362,8 @@
@override
String getArtifactPath(Artifact artifact, { TargetPlatform platform, BuildMode mode }) {
- final String artifactFileName = _artifactToFileName(artifact);
+ platform ??= _currentHostPlatform;
+ final String artifactFileName = _artifactToFileName(artifact, platform);
switch (artifact) {
case Artifact.snapshotDart:
return fs.path.join(_engineSrcPath, 'flutter', 'lib', 'snapshot', artifactFileName);