Last active
January 24, 2019 01:15
-
-
Save EJunWhite/c2d92ddcd7fc9cf39f1aeb6e3737722b to your computer and use it in GitHub Desktop.
Check os
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getOsName(project) { | |
final String osName = System.getProperty("os.name").toLowerCase(); | |
if (osName.contains("linux")) { | |
return ("linux"); | |
} else if (osName.contains("mac os x") || osName.contains("darwin") || osName.contains("osx")) { | |
return ("macos"); | |
} else if (osName.contains("windows")) { | |
return ("windows"); | |
} else if (osName.contains("sunos") || osName.contains("solaris")) { | |
return ("solaris"); | |
} else if (osName.contains("freebsd")) { | |
return ("freebsd"); | |
} | |
return ("unix"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment