MCPcopy Create free account
hub / github.com/HumbleUI/JWM / load

Method load

shared/java/impl/Library.java:32–67  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30 }
31
32 public static synchronized void load() {
33 if (_loaded) return;
34
35 String version = readResource("/jwm.version");
36 File tempDir = new File(System.getProperty("java.io.tmpdir"), "jwm_" + (version == null ? "" + System.nanoTime() : version));
37 String arch = "aarch64".equals(System.getProperty("os.arch")) ? "arm64" : "x64";
38
39 if (Platform.CURRENT == Platform.MACOS) {
40 File library = _extract("/", "libjwm_" + arch + ".dylib", tempDir);
41 System.load(library.getAbsolutePath());
42 } else if (Platform.CURRENT == Platform.WINDOWS) {
43 File library = _extract("/", "jwm_" + arch + ".dll", tempDir);
44 System.load(library.getAbsolutePath());
45 } else if (Platform.CURRENT == Platform.X11) {
46 File library = _extract("/", "libjwm_" + arch + ".so", tempDir);
47 System.load(library.getAbsolutePath());
48 }
49
50 if (tempDir.exists() && version == null) {
51 Runtime.getRuntime().addShutdownHook(new Thread(() -> {
52 try {
53 Files.walk(tempDir.toPath())
54 .map(Path::toFile)
55 .sorted(Comparator.reverseOrder())
56 .forEach((f) -> {
57 f.delete();
58 });
59 } catch (IOException ex) {
60 ex.printStackTrace();
61 }
62 }));
63 }
64
65 _loaded = true;
66 _nAfterLoad();
67 }
68
69 @ApiStatus.Internal
70 @SneakyThrows

Callers 3

startMethod · 0.95
getRefCountMethod · 0.80
uniqueMethod · 0.80

Calls 4

readResourceMethod · 0.95
_extractMethod · 0.95
_nAfterLoadMethod · 0.95
equalsMethod · 0.80

Tested by

no test coverage detected