You can use $version(1) to see if it is Windows (returns '2') or UNIX (returns '3'). If you want to get really fancy you can include %occOptions.inc and then use the $$$isUNIX and $$$isWINDOWS calls (which just check to see if $version(1) is 2 or 3).
Personally, I like using ##class(%Studio.SourceControl.ISC).RunCmd() as it wraps the capture of the output for parsing.
You can tie $version together the other answers into something that is platform independent (warning, I haven't tested this, but I believe the pieces work):
If ($version(1)=2) {
//Is Windows
set sc=##class(%Studio.SourceControl.ISC).RunCmd("Ver",.out,0)
set OS = out(1)
// exercise of parsing exact desired version piece from the string is an exercise left to the reader
} elseif ($version(1)=3) {
//Is UNIX
set sc=##class(%Studio.SourceControl.ISC).RunCmd("uname -a",.out,0)
set OS = out(1)
// exercise of parsing exact desired version piece from the string is an exercise left to the reader
}Hope that helps you Paul!
- Log in to post comments
