My Android Studio project uses git from gradle :
branchName = ByteArrayOutputStream().use { outputStream ->
exec {
commandLine("git branch --show-current")
standardOutput = outputStream
}
outputStream.toString()
}
On Linux and Mac, this works just fine, but on Windows it says:
Could not start 'git'
and I have to replace it with this :
commandLine("cmd", "/c", "git branch --show-current")
this defeats the purpose for me since I want this to work on different platforms and machines. If I add it it'll instead break on Linux and Mac. any suggestions on what should I do ?
You can probably do an OS checking this way