1 package org.simantics.excel;
3 public class ExecEnvironment {
6 APPLE, LINUX, SUN, WINDOWS, UNKNOWN
10 PPC, PPC_64, SPARC, X86, X86_64, UNKNOWN;
13 public final OSType os;
14 public final ARCHType arch;
16 private ExecEnvironment(OSType os, ARCHType arch) {
21 public static ExecEnvironment calculate() {
22 return new ExecEnvironment(calculateOS(), calculateArch());
25 public static ARCHType calculateArch() {
26 String osArch = System.getProperty("os.arch", "");
27 osArch = osArch.toLowerCase();
28 if (osArch.equals("i386") || osArch.equals("i586") || osArch.equals("i686") || osArch.equals("x86"))
30 if (osArch.startsWith("amd64") || osArch.startsWith("x86_64"))
31 return ARCHType.X86_64;
32 if (osArch.equals("ppc"))
34 if (osArch.startsWith("ppc"))
35 return ARCHType.PPC_64;
36 if (osArch.startsWith("sparc"))
37 return ARCHType.SPARC;
38 return ARCHType.UNKNOWN;
41 public static OSType calculateOS() {
42 String osName = System.getProperty("os.name", "");
43 osName = osName.toLowerCase();
44 if (osName.startsWith("mac os x"))
46 if (osName.startsWith("windows"))
47 return OSType.WINDOWS;
48 if (osName.startsWith("linux"))
50 if (osName.startsWith("sun"))
52 return OSType.UNKNOWN;