package com.thebrokenrail.freshcoffee.util; import java.util.Locale; public final class PlatformUtil { private static String getPlatformType() { String raw = System.getProperty("os.name").toLowerCase(Locale.ROOT); if (raw.contains("mac")) { return "macosx"; } else if (raw.contains("linux")) { return "linux"; } else if (raw.contains("windows")) { return "win"; } else { return "other"; } } private static String getArchitectureType() { String raw = System.getProperty("os.arch"); switch (raw) { case "x86": case "i386": case "i686": { return "i686"; } case "amd64": { return "x64"; } case "arm": { return "arm32"; } case "aarch64_be": case "armv8b": case "armv8l": case "aarch64": { return "aarch64"; } default: { return "other"; } } } public static String getPlatform() { return getPlatformType() + '-' + getArchitectureType(); } static String getExecutableExtension() { if ("win".equals(getPlatformType())) { return ".exe"; } else { return ""; } } }