MCPcopy Create free account
hub / github.com/VowpalWabbit/vowpal_wabbit / getPlatformDir

Method getPlatformDir

java/src/main/java/common/Native.java:17–42  ·  view source on GitHub ↗

Detects the current platform and returns the appropriate natives directory name. Supported platforms: linux_64, linux_arm64, macos_x64, macos_arm64, windows_64

()

Source from the content-addressed store, hash-verified

15 * Supported platforms: linux_64, linux_arm64, macos_x64, macos_arm64, windows_64
16 */
17 private static String getPlatformDir() {
18 String os = System.getProperty("os.name", "").toLowerCase();
19 String arch = System.getProperty("os.arch", "").toLowerCase();
20
21 String osDir;
22 if (os.contains("linux")) {
23 osDir = "linux";
24 } else if (os.contains("mac") || os.contains("darwin")) {
25 osDir = "macos";
26 } else if (os.contains("win")) {
27 osDir = "windows";
28 } else {
29 throw new UnsupportedOperationException("Unsupported operating system: " + os);
30 }
31
32 String archDir;
33 if (arch.equals("amd64") || arch.equals("x86_64")) {
34 archDir = osDir.equals("linux") ? "64" : "x64";
35 } else if (arch.equals("aarch64") || arch.equals("arm64")) {
36 archDir = "arm64";
37 } else {
38 throw new UnsupportedOperationException("Unsupported architecture: " + arch);
39 }
40
41 return osDir + "_" + archDir;
42 }
43
44 /**
45 * Returns the platform-specific library file name.

Callers 1

NativeClass · 0.95

Calls 2

containsMethod · 0.80
equalsMethod · 0.45

Tested by

no test coverage detected