<commit_before>/****************************************************************************
 * Copyright (C) 2017 ecsec GmbH.
 * All rights reserved.
 * Contact: ecsec GmbH (<EMAIL>)
 *
 * This file is part of the Open eCard App.
 *
 * GNU General Public License Usage
 * This file may be used under the terms of the GNU General Public
 * License version 3.0 as published by the Free Software Foundation
 * and appearing in the file LICENSE.GPL included in the packaging of
 * this file. Please review the following information to ensure the
 * GNU General Public License version 3.0 requirements will be met:
 * http://www.gnu.org/copyleft/gpl.html.
 *
 * Other Usage
 * Alternatively, this file may be used in accordance with the terms
 * and conditions contained in a signed written agreement between
 * you and ecsec GmbH.
 *
 ***************************************************************************/

package org.openecard.common.util;

import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.annotation.Nonnull;


/**
 * Utility class for system related tasks.
 *
 * @author <NAME>
 */
public class SysUtils {

    private static String getName() {
	return System.getProperty("os.name").toLowerCase();
    }

    public static boolean isWin() {
	return getName().contains("win");
    }

    public static boolean isMacOSX() {
	return getName().contains("mac");
    }

    public static boolean isUnix() {
	String os = getName();
	return os.contains("nux") || os.contains("nix") || os.contains("aix");
    }


    private static final Pattern CURLY_VAR_ENV = Pattern.compile("(\\\\)?(\\$\\{([A-Za-z0-9_]+)\\})");<commit_msg>Add Linux Distribution detection functions to SysUtils<commit_after>/****************************************************************************
 * Copyright (C) 2017 ecsec GmbH.
 * All rights reserved.
 * Contact: ecsec GmbH (<EMAIL>)
 *
 * This file is part of the Open eCard App.
 *
 * GNU General Public License Usage
 * This file may be used under the terms of the GNU General Public
 * License version 3.0 as published by the Free Software Foundation
 * and appearing in the file LICENSE.GPL included in the packaging of
 * this file. Please review the following information to ensure the
 * GNU General Public License version 3.0 requirements will be met:
 * http://www.gnu.org/copyleft/gpl.html.
 *
 * Other Usage
 * Alternatively, this file may be used in accordance with the terms
 * and conditions contained in a signed written agreement between
 * you and ecsec GmbH.
 *
 ***************************************************************************/

package org.openecard.common.util;

import java.io.File;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.annotation.Nonnull;


/**
 * Utility class for system related tasks.
 *
 * @author <NAME>
 */
public class SysUtils {

    private static String getName() {
	return System.getProperty("os.name").toLowerCase();
    }

    public static boolean isWin() {
	return getName().contains("win");
    }

    public static boolean isMacOSX() {
	return getName().contains("mac");
    }

    public static boolean isUnix() {
	String os = getName();
	return os.contains("nux") || os.contains("nix") || os.contains("aix");
    }

    public static boolean isDebianOrDerivate() {
	return new File("/etc/debian_version").exists();
    }

    public static boolean isRedhatOrDerivate() {
	return new File("/etc/redhat-release").exists();
    }

    public static boolean isArchLinuxOrDerivate() {
	return new File("/etc/arch-release").exists();
    }

    public static boolean isSuSEOrDerivate() {
	return new File("/etc/SuSE-release").exists();
    }


    private static final Pattern CURLY_VAR_ENV = Pattern.compile("(\\\\)?(\\$\\{([A-Za-z0-9_]+)\\})");
{'fraction_non_alphanumeric': 0.18878748370273793, 'fraction_numerical': 0.005215123859191656, 'mean_word_length': 4.007832898172324, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5561644', 'n_tokens_mistral': 1092, 'n_tokens_neox': 1011, 'n_words': 363}