public static boolean isOs()

in core/src/main/java/org/apache/ftpserver/util/OS.java [188:248]


    public static boolean isOs(final String family, final String name,
            final String arch, final 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) {
                if (family.equals(FAMILY_WINDOWS)) {
                    isFamily = OS_NAME.indexOf(FAMILY_WINDOWS) > -1;
                } else if (family.equals(FAMILY_OS_2)) {
                    isFamily = OS_NAME.indexOf(FAMILY_OS_2) > -1;
                } else if (family.equals(FAMILY_NETWARE)) {
                    isFamily = OS_NAME.indexOf(FAMILY_NETWARE) > -1;
                } else if (family.equals(FAMILY_DOS)) {
                    isFamily = PATH_SEP.equals(";")
                            && !isFamily(FAMILY_NETWARE);
                } else if (family.equals(FAMILY_MAC)) {
                    isFamily = OS_NAME.indexOf(FAMILY_MAC) > -1;
                } else if (family.equals(FAMILY_TANDEM)) {
                    isFamily = OS_NAME.indexOf("nonstop_kernel") > -1;
                } else if (family.equals(FAMILY_UNIX)) {
                    isFamily = PATH_SEP.equals(":")
                            && !isFamily(FAMILY_OPENVMS)
                            && (!isFamily(FAMILY_MAC) || OS_NAME.endsWith("x"));
                } else if (family.equals(FAMILY_WIN9X)) {
                    isFamily = isFamily(FAMILY_WINDOWS)
                            && (OS_NAME.indexOf("95") >= 0
                                    || OS_NAME.indexOf("98") >= 0
                                    || OS_NAME.indexOf("me") >= 0 || OS_NAME
                                    .indexOf("ce") >= 0);
                } else if (family.equals(FAMILY_Z_OS)) {
                    isFamily = OS_NAME.indexOf(FAMILY_Z_OS) > -1
                            || OS_NAME.indexOf("os/390") > -1;
                } else if (family.equals(FAMILY_OS_400)) {
                    isFamily = OS_NAME.indexOf(FAMILY_OS_400) > -1;
                } else if (family.equals(FAMILY_OPENVMS)) {
                    isFamily = OS_NAME.indexOf(FAMILY_OPENVMS) > -1;
                } else {
                    throw new IllegalArgumentException(
                            "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;
    }