fix: 🐛 Fix running on macos
This commit is contained in:
@ -81,16 +81,35 @@ class FlutterGradlePlugin implements Plugin<Project> {
|
||||
}
|
||||
|
||||
List<String> dartCommand(String... args) {
|
||||
if (System.getProperty('os.name').toLowerCase().contains('windows')) {
|
||||
String osName = System.getProperty('os.name').toLowerCase();
|
||||
if (osName.contains('windows')) {
|
||||
return ['cmd', '/c', 'dart'] + args.toList()
|
||||
} else if (osName.contains('mac')) {
|
||||
String dartPath = new ByteArrayOutputStream().withStream { os ->
|
||||
exec {
|
||||
commandLine 'which', 'dart'
|
||||
standardOutput = os
|
||||
}
|
||||
os.toString().trim()
|
||||
return [dartPath] + args.toList()
|
||||
}
|
||||
} else {
|
||||
return ['dart'] + args.toList()
|
||||
}
|
||||
}
|
||||
|
||||
List<String> flutterCommand(String... args) {
|
||||
if (System.getProperty('os.name').toLowerCase().contains('windows')) {
|
||||
String osName = System.getProperty('os.name').toLowerCase();
|
||||
if (osName.contains('windows')) {
|
||||
return ['cmd', '/c', 'flutter'] + args.toList()
|
||||
} else if (osName.contains('mac')) {
|
||||
String flutterPath = new ByteArrayOutputStream().withStream { os ->
|
||||
exec {
|
||||
commandLine 'which', 'flutter'
|
||||
standardOutput = os
|
||||
}
|
||||
os.toString().trim()
|
||||
return [flutterPath] + args.toList()
|
||||
} else {
|
||||
return ['flutter'] + args.toList()
|
||||
}
|
||||
|
Reference in New Issue
Block a user