Detecting the platform (Window or Linux) by Groovy/Grails
System.properties[‘os.name’] will return the name of the OS, e.g. “Windows XP”. So if you want to figure out whether you’re running on Windows or not, you could do something like: if (System.properties[‘os.name’].toLowerCase().contains(‘windows’)) { println “it’s Windows” } else { println “it’s not Windows” } Alternatively, org.apache.commons.lang.SystemUtils (from the Apache commons-lang project) exposes some boolean constants … Read more