Conditional configuration based on operating system

Hi, I would like to change the configuration of a given task based on the operating system. To be specific, I’m using the protobuf plugin which has a property that defines the location of the protobuf compiler to be invoked. I need to do something like the following:

if (runningOnWindows()) {
    protocPath = 'tools/protoc'
} else {
    protocPath = "${pathToProtoc}"

Is there an easy way to implement the runningOnWindows method?

1 Like

Hey, you can do something like this in your build script:

String osName = System.getProperty("").toLowerCase();
if (osName.contains("windows")) {

regards, René

1 Like

That works great.

Thanks very much.