MCPcopy Create free account
hub / github.com/JetBrains/skija / load

Method load

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

Source from the content-addressed store, hash-verified

60 }
61
62 public static synchronized void load() {
63 if (_loaded) return;
64
65 String version = readResource(_resourcePath + "skija.version");
66 File tempDir = new File(System.getProperty("java.io.tmpdir"), "skija_" + (version == null ? "" + System.nanoTime() : version));
67 File library;
68
69 switch (Platform.CURRENT) {
70 case WINDOWS:
71 _extract(_resourcePath, "icudtl.dat", tempDir);
72 library = _extract(_resourcePath, "skija.dll", tempDir);
73 System.load(library.getAbsolutePath());
74 break;
75 case LINUX:
76 library = _extract(_resourcePath, "libskija.so", tempDir);
77 System.load(library.getAbsolutePath());
78 break;
79 case MACOS_X64:
80 library = _extract(_resourcePath, "libskija_x64.dylib", tempDir);
81 System.load(library.getAbsolutePath());
82 break;
83 case MACOS_ARM64:
84 library = _extract(_resourcePath, "libskija_arm64.dylib", tempDir);
85 System.load(library.getAbsolutePath());
86 break;
87 default:
88 throw new RuntimeException("Unexpected Platform.CURRENT = " + Platform.CURRENT);
89 }
90
91 if (tempDir.exists() && version == null) {
92 Runtime.getRuntime().addShutdownHook(new Thread(() -> {
93 try {
94 Files.walk(tempDir.toPath())
95 .map(Path::toFile)
96 .sorted(Comparator.reverseOrder())
97 .forEach((f) -> {
98 Log.debug("Deleting " + f);
99 f.delete();
100 });
101 } catch (IOException ex) {
102 ex.printStackTrace();
103 }
104 }));
105 }
106
107 _loaded = true;
108 _nAfterLoad();
109 }
110
111 @ApiStatus.Internal
112 @SneakyThrows

Callers 4

staticLoadMethod · 0.95
loopMethod · 0.95
MainMethod · 0.80

Calls 5

readResourceMethod · 0.95
_extractMethod · 0.95
debugMethod · 0.95
_nAfterLoadMethod · 0.95
getPropertyMethod · 0.80

Tested by

no test coverage detected