We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5b4cc4f commit 0b2a408Copy full SHA for 0b2a408
webdev/lib/src/util.dart
@@ -30,7 +30,13 @@ void serveHttpRequests(
30
final String _sdkDir = (() {
31
// The Dart executable is in "/path/to/sdk/bin/dart", so two levels up is
32
// "/path/to/sdk".
33
- final aboveExecutable = p.dirname(p.dirname(Platform.resolvedExecutable));
+ final String dartExecutable = Platform.isWindows
34
+ // Use 'where.exe' to support powershell as well
35
+ ? (Process.runSync('where.exe', ['dart.exe']).stdout as String)
36
+ .split(RegExp('(\r\n|\r|\n)'))
37
+ .first
38
+ : Process.runSync('which', ['dart']).stdout;
39
+ final aboveExecutable = p.dirname(p.dirname(dartExecutable));
40
assert(FileSystemEntity.isFileSync(p.join(aboveExecutable, 'version')));
41
return aboveExecutable;
42
})();
0 commit comments