in src/main/org/apache/tools/ant/taskdefs/condition/Os.java [246:335]
public static boolean isOs(String family, String name, String arch,
String version) {
boolean retValue = false;
if (family != null || name != null || arch != null
|| version != null) {
boolean isFamily = true;
boolean isName = true;
boolean isArch = true;
boolean isVersion = true;
if (family != null) {
//windows probing logic relies on the word 'windows' in
//the OS
boolean isWindows = OS_NAME.contains(FAMILY_WINDOWS);
boolean is9x = false;
boolean isNT = false;
if (isWindows) {
//there are only four 9x platforms that we look for
is9x = (OS_NAME.contains("95")
|| OS_NAME.contains("98")
|| OS_NAME.contains("me")
//wince isn't really 9x, but crippled enough to
//be a muchness. Ant doesn't run on CE, anyway.
|| OS_NAME.contains("ce"));
isNT = !is9x;
}
switch (family) {
case FAMILY_WINDOWS:
isFamily = isWindows;
break;
case FAMILY_9X:
isFamily = isWindows && is9x;
break;
case FAMILY_NT:
isFamily = isWindows && isNT;
break;
case FAMILY_OS2:
isFamily = OS_NAME.contains(FAMILY_OS2);
break;
case FAMILY_NETWARE:
isFamily = OS_NAME.contains(FAMILY_NETWARE);
break;
case FAMILY_DOS:
isFamily = PATH_SEP.equals(";") && !isFamily(FAMILY_NETWARE);
break;
case FAMILY_MAC:
isFamily = OS_NAME.contains(FAMILY_MAC)
|| OS_NAME.contains(DARWIN);
break;
case FAMILY_TANDEM:
isFamily = OS_NAME.contains("nonstop_kernel");
break;
case FAMILY_UNIX:
isFamily = PATH_SEP.equals(":")
&& !isFamily(FAMILY_VMS)
&& (!isFamily(FAMILY_MAC) || OS_NAME.endsWith("x")
|| OS_NAME.contains(DARWIN));
break;
case FAMILY_ZOS:
isFamily = OS_NAME.contains(FAMILY_ZOS)
|| OS_NAME.contains("os/390");
break;
case FAMILY_OS400:
isFamily = OS_NAME.contains(FAMILY_OS400);
break;
case FAMILY_VMS:
isFamily = OS_NAME.contains(FAMILY_VMS);
break;
default:
throw new BuildException(
"Don't know how to detect os family \""
+ family + "\"");
}
}
if (name != null) {
isName = name.equals(OS_NAME);
}
if (arch != null) {
isArch = arch.equals(OS_ARCH);
}
if (version != null) {
isVersion = version.equals(OS_VERSION);
}
retValue = isFamily && isName && isArch && isVersion;
}
return retValue;
}