Skip to content

Commit

Permalink
Fix an issue locating the Flutter SDK on Windows when not invoked via…
Browse files Browse the repository at this point in the history
… 'dart' inside a Flutter SDK (#6668)

If the current Dart VM isn't inside a Flutter SDK, we fall back to trying to find it on `PATH` with `which`. The equiv on Windows is `where.exe`.
  • Loading branch information
DanTup committed Nov 7, 2023
1 parent 51228ba commit 2d558cc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tool/lib/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ class FlutterSdk {
}

// Look to see if we can find the 'flutter' command in the PATH.
// TODO(dantup): This won't work on Windows.
final result = Process.runSync('which', ['flutter']);
final whichCommand = Platform.isWindows ? 'where.exe' : 'which';
final result = Process.runSync(whichCommand, ['flutter']);
if (result.exitCode == 0) {
final sdkPath = result.stdout.toString().split('\n').first.trim();
// 'flutter/bin'
Expand Down

0 comments on commit 2d558cc

Please sign in to comment.