Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions tool/lib/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import 'dart:io';

import 'package:collection/collection.dart';
import 'package:devtools_tool/utils.dart';
import 'package:path/path.dart' as path;

class DevToolsRepo {
Expand Down Expand Up @@ -278,14 +279,16 @@ class FlutterSdk {

final String sdkPath;

static String get flutterExecutableName =>
Platform.isWindows ? 'flutter.bat' : 'flutter';
/// The name of the 'flutter' shell script for the current platform.
static String get flutterExecutableName => shellScriptName('flutter');

/// The name of the 'dart' wrapper shell script in Flutter for the current
/// platform.
///
/// On windows, 'dart' is fine for running the .exe from the Dart SDK directly
/// but the wrapper in the Flutter bin folder is a .bat and needs an explicit
/// extension.
static String get dartWrapperExecutableName =>
Platform.isWindows ? 'dart.bat' : 'dart';
static String get dartWrapperExecutableName => shellScriptName('dart');

String get flutterExePath => path.join(sdkPath, 'bin', flutterExecutableName);

Expand Down
14 changes: 13 additions & 1 deletion tool/lib/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ abstract class DartSdkHelper {
}
}

/// Returns the name of the shell script [name] for the current platform.
///
/// On Windows, shell scripts have `.bat` extensions and must be invoked
/// using them.
Comment thread
DanTup marked this conversation as resolved.
String shellScriptName(String name) {
return Platform.isWindows ? '$name.bat' : name;
}

String localDartSdkLocation() {
final localDartSdkLocation = Platform.environment['LOCAL_DART_SDK'];
if (localDartSdkLocation == null) {
Expand Down Expand Up @@ -86,7 +94,11 @@ class CliCommand {
List<String> args, {
bool throwOnException = true,
}) {
return CliCommand('gclient', args, throwOnException: throwOnException);
return CliCommand(
shellScriptName('gclient'),
args,
throwOnException: throwOnException,
);
}

factory CliCommand.tool(List<String> args, {bool throwOnException = true}) {
Expand Down
Loading